HolyLib Wiki

AsyncDecompress

  util.AsyncDecompress( string data, function callback, number ratio = 0.98 )

Description

Decompresses the given data async.

Instead of copying the given data, we keep a reference to it.
So don't modify it, while were decompressing it!

Arguments

1string data
The data to decompress
2function callback

the callback that is called after we finished compressing it

Function argument(s):
1string data - The decompressed data or nil on failure

3number ratio = 0.98

The maximum allowed decompression ratio.
By default 0.98 allowing 0.2MB to be decompressed to 10MB.
Set to 1 to completely disable this limit
If the decompressed ratio exceeds this limit, the decompression will fail.
This was done as a security fix as received client compressed data with a ratio of 0.999 or something like that could be 16kb compressed but could decompress to 100+MB