Skip to main content
Compresses plaintext into the LZ4 Block format and returns the compressed bytes as a string.
There is no header, no checksum, and no trailing size marker, so you have to remember (or store separately) the original byte length to decompress later. Most commonly used to shrink a large JSON dump or serialized table before writing it to disk with writefile or sending it over request + base64encode.

Parameters

Note: any byte value is allowed, including embedded zeros.

Returns

string - the compressed payload.

Aliases

  • lz4compress

Example

In a chat-event-based Roblox game, stream Bad Apple as ASCII video over a remote at 30fps.
Reason: storing >1800 frames and parsing them would be a lot more easier if you compress the data beforehand.
Useful when saving large configs or sending massive data payloads.