base64 − Lua module for base64 encoding
local base64 = require "base64"
Base64 is a method to represent binary data with only ASCII characters. This can be used for example to embed sound files or images in the Lua script as long strings.
Attention:
The image formats XPM and XBM are already in an ASCII format
and can be embedded directly in a Lua script without further
encoding.
base64.encode(binary-string)
This encodes the binary data in the binary-string with base64. It returns the result as string.
By the way, on GNU systems there is also a command line tool named base64. You can also use that to encode data.
base64.decode(base64-string)
This decodes the base64-string and returns the binary data as a string.
base64.version
This variable holds a version string for the base64 module.