kriskowal / zip

An implementation of unzip in JavaScript for Node
MIT License
85 stars 28 forks source link

Exception on require zip #3

Closed talgiat closed 12 years ago

talgiat commented 13 years ago

just by doing

var ZIP = require("zip");

I get the following exception:

TypeError: undefined is not a function
  at CALL_NON_FUNCTION (native)
  at Object.<anonymous> (/Users/talgiat/projects/blu/node_modules/q-io/buffer-io.js:4:10)
  at Module._compile (module.js:383:26)
  at Object..js (module.js:389:10)
  at Module.load (module.js:315:31)
  at Function._load (module.js:276:12)
  at require (module.js:327:19)
  at Object.<anonymous> (/Users/talgiat/projects/blu/node_modules/zip/lib/inflate.js:8:16)
  at Module._compile (module.js:383:26)
  at Object..js (module.js:389:10)
kriskowal commented 13 years ago

Thank you for reporting. There are a bunch of things broken in my entire toolchain since NPM 1.0 reared its head.

talgiat commented 13 years ago

any idea on when a fix is coming ?

kriskowal commented 13 years ago

On Wed, May 11, 2011 at 6:57 PM, talgiat reply@reply.github.com wrote:

any idea on when a fix is coming ?

Turns out it was just a spurious file in the NPM package. I've republished and it might work fine now. Let me know if you see any further problems. I'll run another test on it soonish.

Kris

helios175 commented 12 years ago

It seems that talgiat didn't answer... I installed it and works pretty fine.

zip 0.0.6
node.js 0.6.5
Windows XP SP3 (x86)
kriskowal commented 12 years ago

Thanks! Awesome to hear it works on Windows with no changes. Let me know if you need API enhancements.

helios175 commented 12 years ago

Well, in fact, I've made a home modification for reading compressed files content only on demand.

I've modified zip.js to create the Entries not with the uncompressed bytes, but with the original_stream, start_position and compressed_length. And then, when Entry.getData is called, if it hasn't its property set (if it was never read) it reads the data. It's useful for reading a zip only in part (by example, reading a typical maven artifact, and extracting pom.xml information). If you want I can send you the modified code (it's very simple). I'm not used to git.

kriskowal commented 12 years ago

That would be awesome. I’d be happy to incorporate that optimization, and wouldn’t mind doing the git patch legwork.

helios175 commented 12 years ago

Ok. Tomorrow I'll send it to you. I promess to learn git soon!

That modification was very handy in my use case: I only needed to retrieve content from one file from the zip (pom.xml from a Maven artifact). I needed to iterate over the entries looking for a matching path.