lz4decompress Synchronous
crypt.lz4.decompresscrypt.lz4decompresslz4.decompress
Expand an LZ4 block previously produced by lz4compress. Supply a capacity when the source is untrusted or your script has a known maximum document size.
Luau
lz4decompress(data: string, maxOutputSize: number?) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
data | string | Compressed LZ4 block. |
maxOutputSize | number? | Optional nonnegative output capacity in bytes. Omit it for the default limit; explicit nil is rejected. |
Returns
stringThe original byte string. Invalid blocks and output that exceeds the selected capacity raise an error.
Usage notes
The optional second argument is a limit, not a promised output length. A valid result can be shorter.
Differences from sUNC
Kawaii accepts an optional second argument, maxOutputSize. The sUNC signature lists only data. This argument is a capacity limit: decompressed output may be shorter than it.
Example
Luau
local packed = lz4compress("saved preferences")
local ok, text = pcall(lz4decompress, packed, 1024)
if ok then print(text) end