zip-paths

0.4.0 • Public • Published

zip-paths

Build Status

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.

Installation

npm install zip-paths

Usage

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

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

Initialization

new zipPaths('path/to/zipfile.zip', [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.

Options:

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.

zip.getFiles()

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.4.0
    2
    • latest

Version History

Package Sidebar

Install

npm i zip-paths

Weekly Downloads

2

Version

0.4.0

License

MIT

Last publish

Collaborators

  • w33ble