base64
Base64 encode / decode between binary and text Luau strings (standard RFC 4648 alphabet, padded).
require("@builtin::modules.api.engine.base64") -- base64 (also available as global 'base64')
The base64 namespace: 6 functions.
globals/base64/decode
base64.decode(text: string) -> (string?, string?)
Decode standard-alphabet base64 text back to the original binary string.
Parameters
textstring— Base64 text to decode.
Returns (string?, string?) decoded bytes on success, or (nil, errmsg).
local bytes = base64.decode(encoded)
globals/base64/encode
base64.encode(bytes: buffer | string) -> string
Encode a binary string to standard-alphabet (padded) base64 text.
Parameters
bytesbuffer | string— Binary bytes to encode.
Returns string — Base64 text.
local text = base64.encode(jpegBytes)
modules/base64/decode
decode(text: string): (string?, string?)
Decode standard-alphabet base64 text back to the original binary string.
Parameters
textstring— Base64 text to decode.
local bytes = base64.decode(encoded)
modules/base64/encode
encode(bytes: buffer | string): string
Encode a binary string to standard-alphabet (padded) base64 text.
Parameters
bytesbuffer | string— Binary bytes to encode.
local text = base64.encode(jpegBytes)
typed/builtin//modules/api/engine/base64/base64/decode
base64.decode(text: string) -> (string?, string?)
Decode standard-alphabet base64 text back to the original binary string.
Parameters
textstring— Base64 text to decode.
Returns (string?, string?) decoded bytes on success, or (nil, errmsg).
local bytes = base64.decode(encoded)
typed/builtin//modules/api/engine/base64/base64/encode
base64.encode(bytes: buffer | string) -> string
Encode a binary string to standard-alphabet (padded) base64 text.
Parameters
bytesbuffer | string— Binary bytes to encode.
Returns string — Base64 text.
local text = base64.encode(jpegBytes)