Zipper, an insanely simple zipfile creator for node.js.

Earlier this week I needed a way to create zip files with node.js. I was shocked to find out that no such thing exists (prove me wrong interwebs!). Some hacks later, zipper was born:

Zipper, an insanely simple zipfile creator for node.js.

a zipper
a zipper by sogni_hal, on Flickr

Zipper has an API that consists of one method:

addFile(name, path, callback)

This method simply adds a file to your chosen zipfile, using an asynchronous operation. Full example:

zipper = require('zipper').Zipper;
var zipfile = new zipper('/path/to/my/zipfile.zip');
zipfile.addFile('myfile.txt', '/path/to/myfile.txt', function (err) {
    if (err) throw err;
    // Do stuff
});

Zipper is available on Github: https://github.com/rubenv/zipper
Or through npm: npm install zipper

Posted: September 16, 2011 07:36 Tags: nodejs zipper

Comments