lz4decompress
Decompresses LZ4 compressed data.
Syntax
lz4decompress(data: string, size: number) -> stringAlso available as crypt.lz4decompress.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | string | The LZ4 compressed data |
size | number | Maximum size of the decompressed output |
Returns
| Type | Description |
|---|---|
string | The decompressed data |
Description
lz4decompress restores data produced by lz4compress. The supplied size must be large enough for the original data.
Example
local original = "This is the original data that will be compressed!"
local compressed = lz4compress(original)
local decompressed = lz4decompress(compressed, #original)
print(original == decompressed) -- trueIf size is too small, decompression fails. When persisting compressed data, store the original byte length alongside it.
Related Functions
lz4compress- Compress with LZ4