Giter VIP home page Giter VIP logo

node-zipfile's Introduction

node-zipfile

Bindings to libzip for handling zipfile archives in node.

Build Status Build status Dependencies Coverage Status

Example

var zipfile = require('zipfile');

// Creating a zipfile object
var zf = new zipfile.ZipFile('./test/data/world_merc.zip');

// the zipfile has a list of names:
// zf.names[0] === 'world_merc.prj'

// the zipfile also has a count property that is the number of files contained
// zf.count == 2

// finally it has a readFile method that uncompresses a single file
// into a Buffer object
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, v4.x, v5.x, or v6.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

node-zipfile's People

Contributors

aaronlidman avatar algunenano avatar elaberge avatar mapsam avatar mourner avatar springmeyer avatar tmcw avatar tomhughes avatar wilhelmberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-zipfile's Issues

Finish pre-gypifying

  • - Update README to explain how install works now
  • - Switch to an aws bucket @mapbox
  • - Update travis to build/test/publish binaries
  • - Tag new version and publish

failing tests on ubuntu precise with node v0.10.21

  ✖ 3 of 14 tests failed:

  1) Handling unicode paths, filenames, and data open zip with folder with unicode:
     AssertionError: false == true
      at Context.<anonymous> (/home/ubuntu/tilemill/node_modules/millstone/node_modules/zipfile/test/unicode.test.js:10:16)
      at Test.Runnable.run (/home/ubuntu/tilemill/node_modules/mocha/lib/runnable.js:200:32)
      at Runner.runTest (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:307:10)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:353:12
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:235:14)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:244:7
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:192:23)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:212:5
      at process._tickCallback (node.js:415:13)
      at Function.Module.runMain (module.js:499:11)
      at startup (node.js:119:16)
      at node.js:901:3

  2) Handling unicode paths, filenames, and data open zip with folder and file with unicode:
     AssertionError: false == true
      at Context.<anonymous> (/home/ubuntu/tilemill/node_modules/millstone/node_modules/zipfile/test/unicode.test.js:19:16)
      at Test.Runnable.run (/home/ubuntu/tilemill/node_modules/mocha/lib/runnable.js:200:32)
      at Runner.runTest (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:307:10)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:353:12
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:235:14)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:244:7
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:192:23)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:212:5
      at process._tickCallback (node.js:415:13)
      at Function.Module.runMain (module.js:499:11)
      at startup (node.js:119:16)
      at node.js:901:3

  3) Handling unicode paths, filenames, and data open zip with unicode paths and unicode filenames in archive:
     AssertionError: false == true
      at Context.<anonymous> (/home/ubuntu/tilemill/node_modules/millstone/node_modules/zipfile/test/unicode.test.js:26:16)
      at Test.Runnable.run (/home/ubuntu/tilemill/node_modules/mocha/lib/runnable.js:200:32)
      at Runner.runTest (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:307:10)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:353:12
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:235:14)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:244:7
      at next (/home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:192:23)
      at /home/ubuntu/tilemill/node_modules/mocha/lib/runner.js:212:5
      at process._tickCallback (node.js:415:13)
      at Function.Module.runMain (module.js:499:11)
      at startup (node.js:119:16)
      at node.js:901:3

Zip archive inconsistent

Dane,

I hate doing this to you but I went back to the Mac running 10.9.1 and I am encountering that problem on the first file I am trying to inspect.

var zipfile = require('zipfile')
filename = "/home/node/shared/production/proddata/radarsat/l1g/zips/RS2_OK16630_PK174790_DK165236_MF1_20101106_230031_HH_SGF.zip"
var zf = new zipfile.ZipFile(filename);
Error: cannot open file: /home/node/shared/production/proddata/radarsat/l1g/zips/RS2_OK16630_PK174790_DK165236_MF1_20101106_230031_HH_SGF.zip error: Zip archive inconsistent

at repl:1:10
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)

Note: The file exists. It can be unzipped fine by Finder and Adm-zip. Just wanted to let you know. I am not sure where to go from there...
File is 141MB
Thanks again.
Pat.

Solaris build fails

> [email protected] install /home/node/node-service/releases/2014-03-12T15-44-00.671130304/node_modules/zipfile

remote: > node-pre-gyp install --fallback-to-build
remote:
remote: node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.0/v8-3.11-solaris-ia32.tar.gz
remote: node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.0/v8-3.11-solaris-ia32.tar.gz
remote: node-pre-gyp ERR! Source compile required: 403 status code downloading tarball
remote: make: Entering directory `/home/node/node-service/releases/2014-03-12T15-44-00.671130304/node_modules/zipfile/build'
remote: ACTION deps_libzip_gyp_action_before_build_target_unpack_libzip_dep Release/obj/gen/libzip-0.11.1/lib/zip_add.c
remote: TOUCH Release/obj.target/deps/action_before_build.stamp.node
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_add.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_add_dir.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_add_entry.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_close.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_delete.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_dir_add.o
remote: CC(target) Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_dirent.o
remote: Release/obj/gen/libzip-0.11.1/lib/zip_dirent.c: In function '_zip_dirent_torrent_normalize':
remote: Release/obj/gen/libzip-0.11.1/lib/zip_dirent.c:600:13: error: 'struct tm' has no member named 'tm_gmtoff'
remote: Release/obj/gen/libzip-0.11.1/lib/zip_dirent.c:600:27: error: 'struct tm' has no member named 'tm_gmtoff'
remote: Release/obj/gen/libzip-0.11.1/lib/zip_dirent.c:601:13: error: 'struct tm' has no member named 'tm_zone'
remote: Release/obj/gen/libzip-0.11.1/lib/zip_dirent.c:601:25: error: 'struct tm' has no member named 'tm_zone'

When node is a fat binary, zipfile is compiled to wrong arch

When using the fat node binary from nodejs.org on Mac OS, there are two architectures - i386 and x86_64. When actually running node, OS X runs the x86_64 binary. But when zipfile compiles it chooses to target i386, and thus node complains when trying to load the zipfile module. The obvious solution is to recompile node from source to one architecture; then the zipfile compiler knows which architecture to target. Is there a better solution, though? This makes the nodejs.org fat binary close to useless.

Tar files in npm registry have incorrectly encoded test filenames

The files in the test directory with unicode names are using codepoints which combine the base character and accent in a single codepoint when fetched from git, which matches what the test scripts expect.

When the tar ball from the npm registry is used however the filenames have separate combining characters for the accents, which mean the tests fail because the names do not match.

As an example, consider tests/data/Clément which should be encoded as:

Cl<U+E9>ment

but in the npm tarball is encoded as:

Cle<U+301>ment

unzip.js fails to unzip Foo.app inside of Foo.zip

Reason is that the directory of Foo.app is not created (on osx) because it is interpreted as a filename. So, need to find a more robust method of determining whether to create folders.

d:Build dane$ unzip.js TermKit.zip 

fs.js:221
  return binding.open(path, stringToFlags(flags), mode);
                 ^
Error: EBADF, Bad file descriptor 'TermKit.app/'
    at Object.openSync (fs.js:221:18)
    at /Users/dane/.nvm/v0.4.7/lib/node/.npm/zipfile/0.1.8/package/bin/unzip.js:29:21
d:Build dane$ coda /Users/dane/.nvm/v0.4.7/lib/node/.npm/zipfile/0.1.8/package/bin/unzip.js

node-waf configure build fails on heroku

Hi, I'm attempting to install Calipso.js onto heroku, and npm throws an error while building zipfile. If I force the working version of zipfile on my laptop to the heroku app, I get the error wrong ELF class: ELFCLASS32, so I think this is x64 related.

Here is the error from the npm log:

   gcc -DHAVE_CONFIG_H -I. -I..  -I../lib   -fPIC -O3 -DNDEBUG -Wall -c tryopen.c
   /bin/bash ../libtool --tag=CC   --mode=link gcc  -fPIC -O3 -DNDEBUG -Wall   -o tryopen tryopen.o ../lib/libzip.la -lz 
   libtool: link: gcc -fPIC -O3 -DNDEBUG -Wall -o tryopen tryopen.o  ../lib/.libs/libzip.a -lz
   make[2]: Leaving directory `/tmp/build_v8mvs3bcd49k/node_modules/zipfile/deps/libzip-0.10/regress'
   make[2]: Entering directory `/tmp/build_v8mvs3bcd49k/node_modules/zipfile/deps/libzip-0.10'
   make[2]: Nothing to be done for `all-am'.
   make[2]: Leaving directory `/tmp/build_v8mvs3bcd49k/node_modules/zipfile/deps/libzip-0.10'
   make[1]: Leaving directory `/tmp/build_v8mvs3bcd49k/node_modules/zipfile/deps/libzip-0.10'
   Waf: Leaving directory `/usr/lib/node_modules/calipso/node_modules/zipfile/build'
   Traceback (most recent call last):
     File "/tmp/node-node-9YD5/bin/node-waf", line 16, in <module>
       Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
       prepare_impl(t, cwd, ver, wafdir)
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
       main()
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
       fun(ctx)
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
       return build_impl(bld)
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
       bld.compile()
     File "/tmp/node-node-9YD5/bin/../lib/node/wafadmin/Build.py", line 268, in compile
       os.chdir(self.bldnode.abspath())
   OSError: [Errno 2] No such file or directory: '/usr/lib/node_modules/calipso/node_modules/zipfile/build'
   npm ERR! [email protected] install: `node-waf configure build`
   npm ERR! `sh "-c" "node-waf configure build"` failed with 1
   npm ERR! 
   npm ERR! Failed at the [email protected] install script.
   npm ERR! This is most likely a problem with the zipfile package,
   npm ERR! not with npm itself.
   npm ERR! Tell the author that this fails on your system:
   npm ERR!     node-waf configure build
   npm ERR! You can get their info via:
   npm ERR!     npm owner ls zipfile
   npm ERR! There is likely additional logging output above.

   npm ERR! System Linux 2.6.32-347-ec2
   npm ERR! command "/tmp/node-node-9YD5/bin/node" "/tmp/node-npm-Y45O/cli.js" "rebuild"
   npm ERR! cwd /tmp/build_v8mvs3bcd49k
   npm ERR! node -v v0.8.8
   npm ERR! npm -v 1.1.49
   npm ERR! code ELIFECYCLE
   npm ERR! 
   npm ERR! Additional logging details can be found in:
   npm ERR!     /tmp/build_v8mvs3bcd49k/npm-debug.log
   npm ERR! not ok code 0

! Failed to rebuild dependencies with npm
! Heroku push rejected, failed to compile Node.js app

Thanks,
Bruce

Building in Windows x64 Failing

I am sure you are aware of this, because a google of my errors return this:

https://ci.appveyor.com/project/Mapbox/node-zipfile/build/1.0.58

Specifically: https://ci.appveyor.com/project/Mapbox/node-zipfile/build/1.0.58/job/uh7jc9h0jk47fhcn

Where I am trying to build on x64 with NodeJS v0.12 with 2013 VS (using --msvs_version=2013)

Here is my debug log: https://www.dropbox.com/s/xkloztkj47ga7sp/npm-debug.log?dl=0
and my cmd output: https://www.dropbox.com/s/dnbmnjjqcfdl9gp/2015-05-30_18-52-32.txt?dl=0

I am using the lastest commit at the time ( https://github.com/mapbox/node-zipfile/tree/6e72a48dd3656c94f63daad77aafac684d501385 ).

Just letting you there is actually a windows user who wants to use this module (or more accurately trying to use it with millstone)

unzipping large files in chunks

files over 1 GB blow up:

DEBUG: unzipping file
DEBUG: saving to: /Users/dane/projects/TileMill/files/.cache/ed4aa8150169ff8b2fc143574020a070/contour-4.shx
DEBUG: saving to: /Users/dane/projects/TileMill/files/.cache/ed4aa8150169ff8b2fc143574020a070/contour-4.qix
DEBUG: saving to: /Users/dane/projects/TileMill/files/.cache/ed4aa8150169ff8b2fc143574020a070/contour-4.prj
DEBUG: saving to: /Users/dane/projects/TileMill/files/.cache/ed4aa8150169ff8b2fc143574020a070/contour-4.dbf
FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData() length exceeds max acceptable value

Any plans to support creation of zip archives?

From a quick glance it looks like libzip would support creating a zip file and adding files from buffers one by one.

Of course, the ideal API in a node context would be one where you could stream the files into the archive one by one, and even stream the resulting archive, e.g. into an HTTP response, instead of writing it to disk.

There's a php module that allows streaming the archive, but requires the files you add to it to be present on disk: http://pablotron.org/software/zipstream-php/

Best regards,
Papandreou

compatibility with node 0.8

Hi,

Do you have any timeline on when you would release a version with the node 0.8 compatibility ?
Thanks.

-Lenin.

The object or library file 'zlib.lib' was created with an older compiler than other objects

Error happening on appveyor in #64 branch.

LINK : fatal error C1047: The object or library file 'C:\projects\node-zipfile\build\Release\zlib.lib' was created with an older compiler than other objects; rebuild old objects and libraries [C:\projects\node-zipfile\build\deps\libzip.vcxproj]
LINK : fatal error LNK1257: code generation failed [C:\projects\node-zipfile\build\deps\libzip.vcxproj]
gypnode-pre-gypFailed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\projects\node-zipfile\lib\binding\node-v11-win32-x64\zipfile.node --module_name=zipfile --module_path=C:\projects\node-zipfile\lib\binding\node-v11-win32-x64' (1)

/cc @BergWerkGIS for help

symbol lookup error

Seeing the below error on some linux systems with v0.5.8.

node: symbol lookup error: /usr/local/src/service-worker/node_modules/shapefile-fairy/node_modules/zipfile/lib/binding/node-v11-linux-x64/zipfile.node: undefined symbol: inflateInit2_

Implement zip_stat() ?

Hi. Great lib you've built here.

Is it possible to implement the zip_stat() function from libzip?

Or, more directly, I would like to know the bytesize of an archived file without having to write it out.

Thanks!

mach-, but wrong architecture

Error: dlopen(/my/app/node_modules/zipfile/lib/_zipfile.node, 1): no suitable image found. Did find:
/my/app/node_modules/zipfile/lib/_zipfile.node: mach-o, but wrong architecture

I'm not sure how to fix this. I started getting this after running npm update -g.

I'm on OSX Snow Leopard 10.6.6 running in 64bit mode.

Please help!

npm rm zipfile causes errors

The ".libs" folder is not deleted so I think it needs to register an preuninstall.
Adding
"preuninstall": "node-waf clean"
should do the trick. This is probably not worth a pull request.
Thanks
Andy

differentiate between files and folders

Is there an obvious way to differentiate between files and folders (is testing the trailing / reliable?) to support say, automatically extracting all of the zip synchronously:

zf.names.forEach(function (name) {
    var dest = path.join(dir, name);
    var buffer = zf.readFileSync(name);
    fs.writeFileSync(dest, buffer);
});

zipfile or node-zipfile?

When installed by npm, node-zipfile is successfully included with require('zipfile'), but when installed with ndistro, it's only accessible by require('node-zipfile').

Is this an ndistro bug, or should we aim for the same naming of repositories and packages?

stale libzip-0.9.3 after make clean

Not sure what the best procedure/protocol is here... but after running make clean libzip-0.9.3 is still present and does not get rebuilt on the next make.

won't build on snow leopard/node 0.4.2

npm ERR! Error: [email protected] install: `./configure;make;make install`
npm ERR! `sh "-c" "./configure;make;make install"` failed with 2
npm ERR!     at ChildProcess. (/usr/local/lib/node/.npm/npm/0.3.14/package/lib/utils/exec.js:49:20)
npm ERR!     at ChildProcess.emit (events.js:45:17)
npm ERR!     at ChildProcess.onexit (child_process.js:171:12)
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the zipfile package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ./configure;make;make install
npm ERR! You can get their info via:
npm ERR!     npm owner ls zipfile
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 10.6.0
npm ERR! argv { remain: [ 'zipfile' ],
npm ERR! argv   cooked: [ 'install', 'zipfile' ],
npm ERR! argv   original: [ 'install', 'zipfile' ] }

Unknown encoding with node v0.3.1-pre

Saw this with 0.3.1-pre, upgrading node fixed, but logging here so others may see solution.

$ ./test.js 
All tests pass...

buffer.js:231
      throw new Error('Unknown encoding');
            ^
Error: Unknown encoding
    at Buffer.write (buffer.js:231:13)
    at new Buffer (buffer.js:148:26)
    at Object.writeSync (fs.js:246:14)
    at /Users/dane/projects/node-zipfile/test.js:60:16
    at /Users/dane/projects/node-zipfile/test.js:44:21
    at path:141:19

Error when requiring zipfile on OSX lion

Some background. I installed Node using the mac osx installer from the node.js website (http://nodejs.org/). My node version is v0.8.1. I then used npm to install zipfile.

When attempting to require zipfile i get this:

Error: dlopen(/Users/me/node_modules/zipfile/lib/_zipfile.node, 1): no suitable image found. Did find:
/Users/me/node_modules/zipfile/lib/_zipfile.node: mach-o, but wrong architecture

I then attempted to builded my own libzip and share it since that appeared to be the problem, I followed the directions and got:

/Users/me/node_modules/zipfile/wscript:108: error:

Cannot find libzip, required for node-zipfile,
please install from:
'http://nih.at/libzip/'
(see README.md for more info)

I saw issue #17 so I thought i'd give you that information as well.

the results are:
/usr/local/bin/node: Mach-O universal binary with 2 architectures
/usr/local/bin/node (for architecture i386): Mach-O executable i386
/usr/local/bin/node (for architecture x86_64): Mach-O 64-bit executable x86_64

Unlike the reporter on 17, i didn't use homebrew and as far as I can tell the mac installer doesn't give you the option to not install the i386 version.

Crash running open.test.js

I'm seeing a crash with 0.4.3 running open.test.js that wasn't happening with the previous release. Crash is in the "test opening invalid archive" test and the backtrace is:

#0  0x00007fcdcdddec7a in memchr () from /lib64/libc.so.6
#1  0x00007fcdca3cefab in _zip_open () from /lib64/libzip.so.2
#2  0x00007fcdca3cf9b4 in zip_open () from /lib64/libzip.so.2
#3  0x00007fcdca5dec79 in ZipFile::New (args=...) at ../src/node_zipfile.cpp:127
#4  0x00007fcdcf3abb4e in v8::internal::Builtin_HandleApiCallConstruct(v8::internal::(anonymous namespace)::BuiltinArguments<(v8::internal::BuiltinExtraArguments)1>, v8::internal::Isolate*) () from /lib64/libv8.so.3

typos in build script

TODO:

libzip not found output - fix README and download link.

i686-apple-darwin10-g++-4.2.1: /usr/include: linker input file unused because linking not done
i686-apple-darwin10-g++-4.2.1: /usr/include: linker input file unused because linking not done

rebuild with nw-gyp

Hello Dane,

thank you very much for sharing this module.

I am currently using node-webkit for a projet. For this I have to rebuild all native modules using a tool called nw-gyp. Unfortunatly, when rebuilding zipfile I get the following error message:

Error: cannot open file #0 in xl/workbook.xml: archive error: Zlib error: incompatible version

I found out that this exception is thrown in line 215 in node_zipfile.cpp.
I am not a big expert in c or c++. And I know that you are not responsible for issues with using nw-gyp. But maybe you or someone else can give me a hint.
I am running Ubuntu, 64 Bit, I dont use libzip as shared library and had no problems compiling and using zlib with node.js and node-gyp.

Tank you very much.

Best regards,
Peter

Feature request: Ability to open buffers as zip files

Hello,

I'm writing an application that parses raw email data and attachments. I'd like to use your library to manipulate zip file attachments, if they exist. After parsing, I have an array of attachment buffers (with some properties). It would be nice if you could add the feature to pass an existing buffer to new zipfile.ZipFile(). This way I wont have to do the round about solution of writing the zip buffer to disk, only to reopen it with zipfile.

Thank you,

Ralph

api documentation

This has more methods than the examples reveal - we should include some api docs to cover them.

File descriptor leak in readFile

There is a zip_open in readFile, but no corresponding zip_close.
So, reading the entries of a large zip file runs out of file descriptors.

compile broken on freebsd

./Release/obj/gen/libzip-0.11.1/lib/zipint.h:53:10: fatal error: 'config.h' file not found
#include "config.h"
         ^
1 error generated.
gmake: *** [Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_err_str.o] Error 1

node segfaults opening a file less than 20 bytes

We found a situation where we can crash node with a segfault by attempting to open an invalid/corrupted zip file less than 20 bytes.

Presumably libzip is reading the headers in one go and going past the end of the file

compile failure on arch linux

Release/obj/gen/libzip-0.11.1/lib/zipint.h:53:20: fatal fejl: config.h: Ingen sådan fil eller filkatalog
 #include "config.h"
                    ^
oversættelse afsluttede.
deps/libzip.target.mk:179: recipe for target 'Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_add_dir.o' failed
make: *** [Release/obj.target/libzip/gen/libzip-0.11.1/lib/zip_add_dir.o] Error 1

Should switch to 'node-gyp'

Hey nice module! I am in the process of attempting to convert existing native modules to use node-gyp, the replacement to node-waf, which has been removed for node v0.8.x.

I see that you already have a .gyp file. Great! A few things:

  1. rename it to bindings.gyp
  2. make it more minimal, a lot of the declarations in there are not necessary, as node and node-gyp handles them for you. Check out the node-gyp README to see what a minimal gyp file looks like.
  3. use node-gyp instead of vcbuild.bat.

Let me know if you need help with any of this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.