Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Inspect and uncompress zipfile archives in Node.js
C++ JavaScript Shell Python
Failed to load latest commit information.
bench convert benchmark to async copyFile
bin finish support for node v0.6
deps ensure zlib is built with same compiler [publish binary]
lib simplify
scripts update the package_osx script [skip ci]
src fix compile with io.js 1.0.1
test async copyFile
tools linting as per google c++ style
.gitignore bump to v0.5.2 with fixed node-pre-gyp bundle
.npmignore bump to v0.5.2 with fixed node-pre-gyp bundle
.travis.yml build for node 0.12.x and io.js v1.2.x
CHANGELOG.md bump to v0.5.7 with updated nan and node-pre-gyp [publish binary]
LICENSE.txt
Makefile fix clean target [skip ci]
README.md use async methods in readme examples
appveyor.yml build against node v0.10.36 / node v0.12.0
binding.gyp code cleanup
configure support node v0.10.x by migrating to node-gyp build system
package.json upgrade to nan@1.7.0
test.js Minor fixes
vcbuild.bat fixup vcbuild.bat

README.md

node-zipfile

Bindings to libzip for handling zipfile archives in node.

Build Status Build status Dependencies

Example

var zipfile = require('zipfile');
var zf = new zipfile.ZipFile('./test/data/world_merc.zip');
zf.readFile('world_merc.prj', function(err, buffer) {
    if (err) throw err;
    console.log(buffer.toString());
});

Large files

To handle large zipfiles and avoid the overhead of passing data from C++ to JS use the copyFile interface:

var zipfile = require('zipfile');
var zf = new zipfile.ZipFile('./test/data/world_merc.zip');
var zip_entry_name = 'world_merc.shp';
var output_file = 'out/world_merc.shp';
zf.copyFile(zip_entry_name,output_file, function(err) {
  if (err) throw err;
  console.log('Successfully wrote ' + output_file);
});

Depends

  • Node v0.10.x or v0.8.x

Installation

Install from binary:

npm install

Install from source:

npm install --build-from-source

Dynamically linking against libzip

node-zipfile depends on libzip, but by default bundles a copy in deps/ which is statically linked and packaged as a binary.

If you want to use an external libzip first install it:

Debian:

sudo apt-get install libzip-dev libzip1

OS X:

brew install libzip

Then configure node-zipfile with the --shared_libzip option:

npm install  --build-from-source --shared_libzip

If you installed libzip in a custom location then configure like:

npm install  --build-from-source --shared_libzip \
  --shared_libzip_includes=/opt/local/include \
  --shared_libzip_libpath=/opt/local/lib

If you installed libzip with homebrew do:

npm install --build-from-source --shared_libzip \
  --shared_libzip_includes=`brew --prefix`/include \
  --shared_libzip_libpath=`brew --prefix`/lib

License

BSD, see LICENSE.txt

Something went wrong with that request. Please try again.