dreamworkAPI
Ctrl K
GitHub
classDocs / deflate / Compressor

deflate.Compressor

classsharedmenusource
Object → deflate.Compressor with deflate.Stream

The DEFLATE stream compressor object.

Constructor

deflate.Compressor(options: deflate.Options?): deflate.Compressor

Methods

flushCompresses all input, writes the last block and returns the compressed data.
resetDrops all input and output, the next update starts a new stream with the same options.
updateAdds the string to the stream.

#Compressor:flush

sharedmenunodiscardsource
function deflate.Compressor:flush(): string

Compresses all input, writes the last block and returns the compressed data.

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

Returns
TypeNameDescription
stringcompressed_data

#Compressor:reset

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

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

Returns
TypeNameDescription
deflate.Compressorself

#Compressor:update

sharedmenusource
function deflate.Compressor:update(raw_data: string): deflate.Compressor

Adds the string to the stream.

Input is compressed in parts of at least 32768 bytes, the last 258 bytes always wait for more input, since a match can continue into it.

The output is the same as deflate.compress of all input, unless another stream or deflate.compress is used between the updates, then the unfinished block is written early, which costs a few bytes.

Parameters
NameTypeDescription
raw_datastringThe string to add.
Returns
TypeNameDescription
deflate.Compressorself

Subclasses

gzip.Compressor, zlib.Compressor

Generated from the dreamwork meta branch.