base64 functions
base64.Encode
Encode data as a Base64 string. Specifically, this uses the standard Base64 encoding as defined in RFC4648 §4 (and not the URL-safe encoding).
Added in gomplate v1.8.0
Usage
Arguments
| name | description |
|---|---|
input |
(required) The data to encode. Can be a string, a byte array, or a buffer. Other types will be converted to strings first. |
Examples
base64.Decode
Decode a Base64 string. This supports both standard (RFC4648 §4) and URL-safe (RFC4648 §5) encodings.
This function outputs the data as a string, so it may not be appropriate
for decoding binary data. Use base64.DecodeBytes
for binary data.
Added in gomplate v1.8.0
Usage
Arguments
| name | description |
|---|---|
input |
(required) The base64 string to decode |
Examples
base64.DecodeBytes
Decode a Base64 string. This supports both standard (RFC4648 §4) and URL-safe (RFC4648 §5) encodings.
This function outputs the data as a byte array, so it’s most useful for
outputting binary data that will be processed further.
Use base64.Decode to output a plain string.
Added in gomplate v3.8.0
Usage
Arguments
| name | description |
|---|---|
input |
(required) The base64 string to decode |