The zlib module provides compression functionality implemented using Gzip,
Deflate/Inflate, and Brotli.
To access it:
constzlib = require('zlib');
Compression and decompression are built around the Node.js Streams API.
Compressing or decompressing a stream (such as a file) can be accomplished by
piping the source stream through a zlibTransform stream into a destination
stream:
The
zlib
module provides compression functionality implemented using Gzip, Deflate/Inflate, and Brotli.To access it:
Compression and decompression are built around the Node.js
Streams API
.Compressing or decompressing a stream (such as a file) can be accomplished by piping the source stream through a
zlib
Transform
stream into a destination stream:It is also possible to compress or decompress data in a single step:
See
source