How can I compress a file/files and save into a .zip
extension file with the provided node.js zlib module? I figured how to save into .gz
using gzip like the following:
const gzip = zlib.createGzip();
const fs = require('fs');
const input = fs.createReadStream('myfile.txt');
const out = fs.createWriteStream('myfile.txt.gz');
input.pipe(gzip).pipe(out);