Encoding
Convert byte strings to and from Base64, or compress them with LZ4 and Zstandard. Decoding and decompression return raw bytes as Luau strings.
Functions
base64decodeRestore the original bytes from Base64 text. The result can be read as text or passed to a function that accepts binary strings. Use it to recover binary content received through a text format. Invalid Base64 raises an error, so handle decoding failures for user-supplied input.
base64encodeRepresent a string’s bytes as Base64 text so binary data can be stored or transferred through text-based formats. Use it when JSON or another text channel must carry bytes. Base64 increases the representation size and provides neither compression nor encryption.
lz4compressCompress a string’s bytes into an LZ4 block. Pass the returned string to lz4decompress when the original data is needed again. Use it to reduce repetitive data before storage or transfer. The output is binary; retain the format information so the reader knows which decompressor to use.
lz4decompressRestore a string from an LZ4-compressed block. This reverses lz4compress and returns the original bytes. Use it to load data saved with LZ4. A compressed payload must be decoded with the same format; Zstandard data belongs to zstddecompress.
zstdcompressCompress a byte string using Zstandard and an optional compression level. Use it for compact storage of larger text or binary content. Compression returns binary data, so Base64-encode it separately if the destination only accepts text.
zstddecompressDecompress bytes produced in the Zstandard format. Use it when loading data saved with zstdcompress. Keep track of the compression format yourself; this is not an automatic decoder for LZ4 or Base64.