github.com/wynshop-open-source/gomplate@v3.5.0+incompatible/docs-src/content/functions/base64.yml (about)

     1  ns: base64
     2  preamble: ''
     3  funcs:
     4    - name: base64.Encode
     5      description: |
     6        Encode data as a Base64 string. Specifically, this uses the standard Base64 encoding as defined in [RFC4648 §4](https://tools.ietf.org/html/rfc4648#section-4) (and _not_ the URL-safe encoding).
     7      pipeline: false
     8      arguments:
     9        - name: input
    10          required: true
    11          description: The data to encode. Can be a string, a byte array, or a buffer. Other types will be converted to strings first.
    12      examples:
    13        - |
    14          $ gomplate -i '{{ base64.Encode "hello world" }}'
    15          aGVsbG8gd29ybGQ=
    16        - |
    17          $ gomplate -i '{{ "hello world" | base64.Encode }}'
    18          aGVsbG8gd29ybGQ=
    19    - name: base64.Decode
    20      description: |
    21        Decode a Base64 string. This supports both standard ([RFC4648 §4](https://tools.ietf.org/html/rfc4648#section-4)) and URL-safe ([RFC4648 §5](https://tools.ietf.org/html/rfc4648#section-5)) encodings.
    22  
    23        This implementation outputs the data as a string, so it may not be appropriate for decoding binary data. If this functionality is desired, [file an issue](https://github.com/hairyhenderson/gomplate/issues/new).
    24      pipeline: false
    25      arguments:
    26        - name: input
    27          required: true
    28          description: The base64 string to decode
    29      examples:
    30        - |
    31          $ gomplate -i '{{ base64.Decode "aGVsbG8gd29ybGQ=" }}'
    32          hello world
    33        - |
    34          $ gomplate -i '{{ "aGVsbG8gd29ybGQ=" | base64.Decode }}'
    35          hello world