encode_base64
encode_base64 将缓冲区或字符串编码为 base64 字符串。
输入
| 名称 | 类型 | 描述 |
|---|---|---|
value | buffer、string、addon | 要编码的缓冲区或字符串。以 '0x' 开头的字符串将被解码为十六进制;否则,使用原始 UTF-8 字节。 |
输出
| 名称 | 类型 | 描述 |
|---|---|---|
value | string | 输入内容编码后的 base64 字符串 |
output "encoded" {value = encode_base64("0x48656c6c6f20776f726c6421")}// > encoded: SGVsbG8gd29ybGQh
decode_base64
decode_base64 解码 base64 编码的字符串,并将结果以缓冲区形式返回。
输入
| 名称 | 类型 | 描述 |
|---|---|---|
base64_string | string | 要解码的 base64 字符串 |
输出
| 名称 | 类型 | 描述 |
|---|---|---|
value | buffer | 解码后的 base64 字符串,以缓冲区形式返回 |
output "decoded" {value = decode_base64("SGVsbG8gd29ybGQh")}// > decoded: 0x48656c6c6f20776f726c6421
Is this page helpful?