dreamworkAPI
Ctrl K
GitHub
classDocs / zlib / Decompressor

zlib.Decompressor

classsharedmenusource
Object → deflate.Decompressor → zlib.Decompressor

The zlib stream decompressor object.

Constructor

deflate.Decompressor(dictionary: string?): zlib.Decompressor

Methods

flushDecodes all input, checks the checksum and returns the decompressed data.
flushDecodes all input and returns the decompressed data.
resetDrops all input and output, the next update starts a new stream with the same dictionary.
resetDrops all input and output, the next update starts a new stream with the same dictionary.
updateAdds the compressed string to the stream.
updateAdds the compressed string to the stream.

#Decompressor:flush

sharedmenunodiscardsource
function zlib.Decompressor:flush(): string, string

Decodes all input, checks the checksum and returns the decompressed data.

The stream is reset after this, so the decompressor can be used for the next stream.

Throws an error on malformed or truncated data, or if the checksum does not match; call via pcall() when processing untrusted input.

Returns
TypeNameDescription
stringdecompressed_dataThe decompressed string.
stringremaining_dataThe data after the end of the stream.

#Decompressor:flush

sharedmenunodiscardsource
function deflate.Decompressor:flush(): string, string

Decodes all input and returns the decompressed data.

The stream is reset after this, so the decompressor can be used for the next stream.

Throws an error on malformed or truncated data; call via pcall() when processing untrusted input.

Returns
TypeNameDescription
stringdecompressed_dataThe decompressed string.
stringremaining_dataThe data after the end of the stream (like the zlib or gzip trailer).

#Decompressor:reset

sharedmenusource
function zlib.Decompressor:reset(): zlib.Decompressor

Drops all input and output, the next update starts a new stream with the same dictionary.

Returns
TypeNameDescription
zlib.Decompressorself

#Decompressor:reset

sharedmenusource
function deflate.Decompressor:reset(): deflate.Decompressor

Drops all input and output, the next update starts a new stream with the same dictionary.

Returns
TypeNameDescription
deflate.Decompressorself

#Decompressor:update

sharedmenusource
function zlib.Decompressor:update(compressed_data: string): zlib.Decompressor

Adds the compressed string to the stream.

Throws an error on malformed data and resets the decompressor; call via pcall() when processing untrusted input.

Parameters
NameTypeDescription
compressed_datastringThe next part of the zlib stream.
Returns
TypeNameDescription
zlib.Decompressorself

#Decompressor:update

sharedmenusource
function deflate.Decompressor:update(compressed_data: string): deflate.Decompressor

Adds the compressed string to the stream.

Input is decoded in parts of at least 32768 bytes, the decompressor is reset on malformed data.

Throws an error on malformed data; call via pcall() when processing untrusted input.

Parameters
NameTypeDescription
compressed_datastringThe next part of the DEFLATE stream.
Returns
TypeNameDescription
deflate.Decompressorself
Generated from the dreamwork meta branch.