On this page

Convenience methods

History

All of these take a Buffer, TypedArray, DataView, ArrayBuffer, or string as the first argument, an optional second argument to supply options to the zlib classes and will call the supplied callback with callback(error, result).

Every method has a *Sync counterpart, which accept the same arguments, but without a callback.

M

zlib.brotliCompress

History
zlib.brotliCompress(buffer, options?, callback): void
Attributes
M

zlib.brotliCompressSync

History
zlib.brotliCompressSync(buffer, options?): void
Attributes

Compress a chunk of data with BrotliCompress.

M

zlib.brotliDecompress

History
zlib.brotliDecompress(buffer, options?, callback): void
Attributes
M

zlib.brotliDecompressSync

History
zlib.brotliDecompressSync(buffer, options?): void
Attributes

Decompress a chunk of data with BrotliDecompress.

zlib.deflate(buffer, options?, callback): void
Attributes
zlib.deflateSync(buffer, options?): void
Attributes

Compress a chunk of data with Deflate.

zlib.deflateRaw(buffer, options?, callback): void
Attributes
zlib.deflateRawSync(buffer, options?): void
Attributes

Compress a chunk of data with DeflateRaw.

zlib.gunzip(buffer, options?, callback): void
Attributes
zlib.gunzipSync(buffer, options?): void
Attributes

Decompress a chunk of data with Gunzip.

zlib.gzip(buffer, options?, callback): void
Attributes
zlib.gzipSync(buffer, options?): void
Attributes

Compress a chunk of data with Gzip.

zlib.inflate(buffer, options?, callback): void
Attributes
zlib.inflateSync(buffer, options?): void
Attributes

Decompress a chunk of data with Inflate.

zlib.inflateRaw(buffer, options?, callback): void
Attributes
zlib.inflateRawSync(buffer, options?): void
Attributes

Decompress a chunk of data with InflateRaw.

zlib.unzip(buffer, options?, callback): void
Attributes
zlib.unzipSync(buffer, options?): void
Attributes

Decompress a chunk of data with Unzip.

M

zlib.zstdCompress

History
zlib.zstdCompress(buffer, options?, callback): void
Stability: 1Experimental
Attributes
M

zlib.zstdCompressSync

History
zlib.zstdCompressSync(buffer, options?): void
Stability: 1Experimental
Attributes

Compress a chunk of data with ZstdCompress.

M

zlib.zstdDecompress

History
zlib.zstdDecompress(buffer, options?, callback): void
Attributes
M

zlib.zstdDecompressSync

History
zlib.zstdDecompressSync(buffer, options?): void
Stability: 1Experimental
Attributes

Decompress a chunk of data with ZstdDecompress.