Node.js provides Zlib module to zip a file. The given example demonstrates this -
var zlib = require('zlib');
var fs = require('fs');
var gzip = zlib.createGzip();
var r = fs.createReadStream('./demofile.txt');
var w = fs.createWriteStream('./demogzipfile.txt.gz');
r.pipe(gzip).pipe(w);
Solution
Node.js provides Zlib module to zip a file. The given example demonstrates this -
need an explanation for this answer? contact us directly to get an explanation for this answer