Base64

    Available since v0.5.0

    Encode and Decode Base64

    local base64 = require "base64"
    

    base64.encode(value)

    Encodes a Lua string/bytes as a base64 string.

    local bytes = io.open("binfile", "rb"):read("*a")
    local str = base64.encode(bytes) -- or just calling base64(bytes) directly
    

    base64.decode(str)

    Decodes a base64 string into a Lua string/bytes.

    local bytes = base64.decode(str)
    

    base64.urlsafe()

    Returns a URL-safe base64 encoder/decoder.

    local base64 = require("base64").urlsafe()
    
    -- The rest of the API is the same