| title | crypt.base64encode |
|---|
Encodes data into a Base64 string.
crypt.base64encode(data: string): stringBase64 turns any data - even bytes that aren't normal text - into plain text characters. That lets it go through JSON, a remote, or a file without breaking. The result is about a third bigger than the input.
Most commonly used to make a binary payload safe to send over request or store with writefile.
| Parameter | Type | Description |
|---|---|---|
data |
string |
The bytes to encode. |
string - the Base64-encoded text.
base64.encodebase64_encodebase64encodecrypt.base64.encodecrypt.base64_encode
Encode a value with Base64, then cache it to disk with writefile.
local base64encode = crypt.base64encode("Hello, world!")local blob = crypt.base64encode("Hello, world!")
print(blob) --> "SGVsbG8sIHdvcmxkIQ=="
writefile("config.cache", blob)