Module brieflz
Lua binding for BriefLZ library.
Functions
pack (data) | Compresses the given data using BriefLZ algorithm. |
depack (data, depacked_size) | Decompresses the given data using BriefLZ algorithm. |
Fields
_NAME | |
_VERSION | |
_BLZ_VERSION |
Functions
- pack (data)
-
Compresses the given
data
using BriefLZ algorithm.This is a low-level function, it does not add any headers to the packed data! You must know the exact size of (uncompressed) data to be able to depack it.
Parameters:
- data string The data to compress.
Returns:
- string Compressed data.
-
int
Size of the (uncompressed)
data
. - int Size of the compressed data.
See also:
- depack (data, depacked_size)
-
Decompresses the given
data
using BriefLZ algorithm.This is very low-level function. It does not expect any headers in the packed data, so you must know the exact size of uncompressed data! If you specify incorrect
depacked_size
, it raises an error. However, it's memory-safe, i.e. it will not segfault in this case.Parameters:
- data string The compressed data.
- depacked_size int Size of the decompressed data (must exactly match!).
Returns:
-
string
Uncompressed data.
Raises:
if thedata
ordepacked_size
is invalid.See also: