encode_base64
encode_base64 encodes a buffer or string as a base64 string.
Inputs
| Name | Type | Description |
|---|---|---|
value | buffer, string, addon | The buffer or string to encode. Strings starting with '0x' are decoded as hex; otherwise, raw UTF-8 bytes are used. |
Output
| Name | Type | Description |
|---|---|---|
value | string | The input, encoded as a base64 string |
output "encoded" {value = encode_base64("0x48656c6c6f20776f726c6421")}// > encoded: SGVsbG8gd29ybGQh
decode_base64
decode_base64 decodes a base64 encoded string and returns the result as a
buffer.
Inputs
| Name | Type | Description |
|---|---|---|
base64_string | string | The base64 string to decode |
Output
| Name | Type | Description |
|---|---|---|
value | buffer | The decoded base64 string, as a buffer |
output "decoded" {value = decode_base64("SGVsbG8gd29ybGQh")}// > decoded: 0x48656c6c6f20776f726c6421
Is this page helpful?