paperclip
paperclip

Reputation: 2330

Unzip files with node.js on Windows

What options are there to handle unzipping .zip files from within a Node.js script on Windows (XP)?

I'm working with the latest (at present) node.js v0.5.8 Windows node.exe.

Suggestions welcome.

-P.

Upvotes: 3

Views: 7255

Answers (3)

Gopal Saini
Gopal Saini

Reputation: 357

ADM-ZIP is a pure JavaScript implementation for zip data compression for NodeJS.

Upvotes: 2

helios
helios

Reputation: 13851

I've found this zip library. It's very easy to install and use:

npm install zip
/* Only js dependencies, no local building needed */

from test.js

var z = require("zip");
var FS = require("fs");
var data = FS.readFileSync("test.zip")
var reader = z.Reader(data);
console.log(reader.toObject('utf-8'));

Provides also ways to iterate through the zip entries and getting data through Buffers.

Upvotes: 2

blockchaindev
blockchaindev

Reputation: 3196

Node provides support for the ZLIB library which should allow you to decompress a zip file using gzip: http://nodejs.org/docs/v0.5.8/api/zlib.html

Upvotes: 2

Related Questions