Zip.zip()

Compress the specified source files or directories into a .zip file.

If something already exists at the specified destination (where the .zip file is going to go), it will be overwritten. If any of the specified sources do not exist, they will be ignored.

Usage

Hover over inputs/exits for more info.

var Zip = require('machinepack-zip');


// Compress the specified source files or directories into a .zip file.

Zip.zip({

sources: [ '/Users/mikermcneil/foo/api/' ],

destination: '/Users/mikermcneil/my-app.zip',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

sources required

The paths (relative or absolute) to the files or directories to zip.

[ '/Users/mikermcneil/foo/api/' ]
destination required

The path (relative or absolute) where the .zip file should be written.

'/Users/mikermcneil/my-app.zip'

Exits

error

An unexpected error occurred.

success

OK.

{ bytesWritten: 3523523 }