Node.js module
zlib
The 'node:zlib' module provides compression and decompression APIs for the zlib library, including Gzip, Deflate, Brotli, and raw deflate/inflate streams.
It offers both streaming and callback-based methods, with configurable compression levels and flush modes, making it suitable for data compression, HTTP content encoding, and file archiving.
Fully supported in Bun
Fully implemented. 98% of Node.js's test suite passes.
Functions 34
- zlib.brotliCompress()
- zlib.brotliCompressSync()
Compress a chunk of data with
BrotliCompress. - zlib.brotliDecompress()
- zlib.brotliDecompressSync()
Decompress a chunk of data with
BrotliDecompress. - zlib.crc32()
Computes a 32-bit Cyclic Redundancy Check checksum of
data. - zlib.createBrotliCompress()
Creates and returns a new
BrotliCompressobject. - zlib.createBrotliDecompress()
Creates and returns a new
BrotliDecompressobject. - zlib.createDeflate()
Creates and returns a new
Deflateobject. - zlib.createDeflateRaw()
Creates and returns a new
DeflateRawobject. - zlib.createGunzip()
Creates and returns a new
Gunzipobject. - zlib.createGzip()
Creates and returns a new
Gzipobject. - zlib.createInflate()
Creates and returns a new
Inflateobject. - zlib.createInflateRaw()
Creates and returns a new
InflateRawobject. - zlib.createUnzip()
Creates and returns a new
Unzipobject. - zlib.createZstdCompress()
Creates and returns a new
ZstdCompressobject. - zlib.createZstdDecompress()
Creates and returns a new
ZstdDecompressobject. - zlib.deflate()
- zlib.deflateRaw()
- zlib.deflateRawSync()
Compress a chunk of data with
DeflateRaw. - zlib.deflateSync()
Compress a chunk of data with
Deflate. - zlib.gunzip()
- zlib.gunzipSync()
Decompress a chunk of data with
Gunzip. - zlib.gzip()
- zlib.gzipSync()
Compress a chunk of data with
Gzip. - zlib.inflate()
- zlib.inflateRaw()
- zlib.inflateRawSync()
Decompress a chunk of data with
InflateRaw. - zlib.inflateSync()
Decompress a chunk of data with
Inflate. - zlib.unzip()
- zlib.unzipSync()
Decompress a chunk of data with
Unzip. - zlib.zstdCompress()
- zlib.zstdCompressSync()
Compress a chunk of data with
ZstdCompress. - zlib.zstdDecompress()
- zlib.zstdDecompressSync()
Decompress a chunk of data with
ZstdDecompress.