Easily archive paths to zip files

npm install zip-paths
7 downloads in the last week
19 downloads in the last month


Codeship Status for goansible/zip-paths

Node module to zip paths using file globbing.

This is basically a wrapper around node-archiver that uses node-glob to queue up files for compression.

The paths that match the globbing pattern are used in the resulting zip file.


npm install zip-paths


var zipPaths = require('zip-paths');
zip = new zipPaths('');

zip.add('js/*.js', function(err) {
  if (err) { /* handle error */ }
  zip.compress(function(err, bytes) {
    console.log("wrote %s bytes", bytes)


new zipPaths('path/to/', [options])

The first parameter is the desired file path of the resulting archive.

options is pased to node-archiver. In the case of zip, they get passed directly to node's zlib. Default level is 9.


refer to zlib for zip options. Additional options include:

  • archiveType: Type of archive to create, zip or tar - default zip

zip.add(pattern, [options], callback(err){})

Add files to be zipped. Using globbing patters here (such as path/*.ext) is valid (see node-glob for more info).

You can optionally pass in an options opbject that will be passed directly to node-glob. Passing in cwd will adjust the paths in the resulting archive as well.


Return an array of all files queued for archiving.

zip.compress(callback(err, bytes){})

Create the archive. Calls node-archive's finalize method directly and passes the callback along.

npm loves you