On this page

C

zlib.ZlibBase

History
class zlib.ZlibBase extends undefined

Not exported by the node:zlib module. It is documented here because it is the base class of the compressor/decompressor classes.

This class inherits from stream.Transform, allowing node:zlib objects to be used in pipes and similar stream operations.

P

zlib.bytesWritten

History
Type:number

The zlib.bytesWritten property specifies the number of bytes written to the engine, before the bytes are processed (compressed or decompressed, as appropriate for the derived class).

M

zlib.close

History
zlib.close(callback?): void
Attributes
callback:Function

Close the underlying handle.

M

zlib.flush

History
zlib.flush(kind?, callback): void
  • kind Default: zlib.constants.Z_FULL_FLUSH for zlib-based streams, zlib.constants.BROTLI_OPERATION_FLUSH for Brotli-based streams.
  • callback Function

Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.

Calling this only flushes data from the internal zlib state, and does not perform flushing of any kind on the streams level. Rather, it behaves like a normal call to .write(), i.e. it will be queued up behind other pending writes and will only produce output when data is being read from the stream.

M

zlib.params

History
zlib.params(level, strategy, callback): void
Attributes
level:integer
strategy:integer
callback:Function

This function is only available for zlib-based streams, i.e. not Brotli.

Dynamically update the compression level and compression strategy. Only applicable to deflate algorithm.

M

zlib.reset

History
zlib.reset(): void

Reset the compressor/decompressor to factory defaults. Only applicable to the inflate and deflate algorithms.