Syntax
lz4compress(data: string): stringAliases
crypt.lz4compresscrypt.lz4.compresslz4.compressArguments
| Name | Type | Description |
|---|---|---|
data | string | Input byte string or text processed by the function. |
Returns
| Name | Type | Description |
|---|---|---|
compressed | string | Compressed byte string. |
Description
Compresses a string using LZ4 to reduce size before storage or transfer.
Call it with 1 parameter(s): data. The argument table explains which values are required and which ones only refine the behavior.
It returns compressed (string). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Compress a string and restore it using its original size.
local source = string.rep("Real Docs ", 100)
local compressed = lz4compress(source)
local restored = lz4decompress(compressed, #source)
print(#source, #compressed, restored == source)