Zlib | Node.js v16.1.0 Documentation
To access it: const { createGzip } = require('zlib'); const { pipeline } = require('stream'); const { createReadStream, createWriteStream } = require('fs'); const gzip = createGzip(); const source = createReadStream('input.txt'); const destination = createWriteStream('input.txt.gz'); pipeline(source, gzip, destination, { if (err) { console.error('An error occurred:', err); process.exitCode = 1; } });
https://nodejs.org/api/zlib.html#zlib_class_zlib_deflate