Represents a handle for interacting with an inflate stream initiated by inflater().
const zstrmi = inflater();
for (let data = ...; data; data = ...) {
zstrmi.write(data, Z_SYNC_FLUSH); // write compressed data to stream
if (foo)
let defl = zstrmi.read(); // read back decompressed stream content
}
zstrmi.error();
- Source
- See
- module:zlib#inflater()
Methods
error() → {string}nullable
Queries error information.
Returns a string containing a description of the last occurred error or null
if there is no error information.
- Source
read() → {string}nullable
Reads a chunk of decompressed data from the inflate stream.
Returns the current content of the inflate buffer, fed through module:zlib.inflate#write.
Returns decompressed chunk on success.
Returns null
if an error occurred.
- Source
write(src, flushopt, nullable) → {boolean}nullable
Writes a chunk of data to the inflate stream.
Input data must be a string, it is internally decompressed by the zlib inflate()
routine, the end result is buffered according to the requested flush
mode until read via module:zlib.inflate#read. Valid flush
values are Z_NO_FLUSH
(the default), Z_SYNC_FLUSH, Z_FINISH
. If flush
is Z_FINISH
then no more data can be written to the stream. Refer to the Zlib manual for details on each flush mode.
Returns true
on success.
Returns null
if an error occurred.
Name | Type | Description |
---|---|---|
src | string | The string of data to inflate. |
flush | number | (optional, nullable, default: Z_NO_FLUSH )The zlib flush mode. |
- Source