dreamworkAPI
Ctrl K
GitHub
classDocs / gzip / Decompressor

gzip.Decompressor

classsharedmenusource
Object → deflate.Decompressor → gzip.Decompressor

The gzip stream decompressor object.

Constructor

deflate.Decompressor(): gzip.Decompressor

Methods

flushDecodes all input, checks the checksum and the size, 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.
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 gzip.Decompressor:flush(): string, string, gzip.Header

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

Concatenated gzip members are decompressed into one string, like gzip.decompress does, the members after the first one are decoded here at once.

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 or the size 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.
gzip.HeaderheaderThe header of the first member.

#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 gzip.Decompressor:reset(): gzip.Decompressor

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

Returns
TypeNameDescription
gzip.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 gzip.Decompressor:update(compressed_data: string): gzip.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 gzip stream.
Returns
TypeNameDescription
gzip.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.