base64
Function
base64 — encode/decode Base64 strings
Synopsis
base64(b: bytes) -> string
base64(s: string) -> bytes
Description
The base64 function encodes a bytes value b
as a
a Base64 string,
or decodes a Base64 string s
into a bytes value.
Examples
Encode byte sequence 0x010203
into its Base64 string:
yield base64(this)
0x010203
Loading...
echo '0x010203' \
| super -z -c 'yield base64(this)' -
Decode “AQID” into byte sequence 0x010203
:
yield base64(this)
"AQID"
Loading...
echo '"AQID"' \
| super -z -c 'yield base64(this)' -
Encode ASCII string into Base64-encoded string:
yield base64(bytes(this))
"hello, world"
Loading...
echo '"hello, world"' \
| super -z -c 'yield base64(bytes(this))' -
Decode a Base64 string and cast the decoded bytes to a string:
yield string(base64(this))
"aGVsbG8gd29ybGQ="
Loading...
echo '"aGVsbG8gd29ybGQ="' \
| super -z -c 'yield string(base64(this))' -