github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/encoding/base64decode.mdx (about)

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