Syntax
lz4decompress(data: string, originalSize?: number): stringAliases
crypt.lz4decompresscrypt.lz4.decompresslz4.decompressArguments
| Name | Type | Description |
|---|---|---|
data | string | Raw compressed bytes passed to LZ4 block decompression. |
originalSize? | number | Output buffer size passed as dstCapacity. For lz4compress output, pass the original uncompressed byte length; when omitted, the compressed input length is used. |
Returns
| Name | Type | Description |
|---|---|---|
decompressed | string | Raw decompressed bytes returned as a Lua string. The output can be shorter than originalSize. |
Description
Decompresses raw LZ4 block bytes with LZ4 block decompression and returns raw decompressed bytes as a Lua string.
Call it with 2 parameter(s): data, originalSize. The argument table explains which values are required and which ones only refine the behavior.
It returns decompressed (string). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Decompress LZ4 bytes by passing the original uncompressed size.
local source = "Real Docs"
local compressed = lz4compress(source)
local decompressed = lz4decompress(compressed, #source)
print(decompressed)
print(decompressed == source)