Zip archives in node.js


Question

I want to create a zip archive and unzip it in node.js. I can't find any node implementation. Please help.

1
45
2/22/2017 10:20:09 PM

node-core has built in zip features: http://nodejs.org/api/zlib.html

Use them:

var zlib = require('zlib');
var gzip = zlib.createGzip();
var fs = require('fs');
var inp = fs.createReadStream('input.txt');
var out = fs.createWriteStream('input.txt.gz');

inp.pipe(gzip).pipe(out);
28
6/17/2014 8:22:09 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon