lz4decompress Synchronous
crypt.lz4.decompresscrypt.lz4decompresslz4.decompress
Restore 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.
Luau
lz4decompress(data: string, maxOutputSize: number?) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
data | string | LZ4 block to decompress. |
maxOutputSize | number? | Optional non-negative output capacity in bytes. Omit the argument when no smaller limit is needed; explicit nil is rejected. |
Returns
stringThe decompressed string. Invalid compressed data or output exceeding the supplied limit raises an error.
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 compressed = lz4compress("hello hello hello")
print(lz4decompress(compressed, 1024)) -- hello hello hello