github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/encoding/base64decode.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: base64decode - Functions - Configuration Language
     4  description: The base64decode function decodes a string containing a base64 sequence.
     5  ---
     6  
     7  # `base64decode` Function
     8  
     9  `base64decode` takes a string containing a Base64 character sequence and
    10  returns the original string.
    11  
    12  Nomad uses the "standard" Base64 alphabet as defined in
    13  [RFC 4648 section 4](https://tools.ietf.org/html/rfc4648#section-4).
    14  
    15  Strings in the Nomad language are sequences of unicode characters rather
    16  than bytes, so this function will also interpret the resulting bytes as
    17  UTF-8. If the bytes after Base64 decoding are _not_ valid UTF-8, this function
    18  produces an error.
    19  
    20  ## Examples
    21  
    22  ```shell-session
    23  > base64decode("SGVsbG8gV29ybGQ=")
    24  Hello World
    25  ```
    26  
    27  ## Related Functions
    28  
    29  - [`base64encode`](/docs/job-specification/hcl2/functions/encoding/base64encode) performs the opposite operation,
    30    encoding the UTF-8 bytes for a string as Base64.