EvanOxfeld / node-unzip

node.js cross-platform unzip using streams
MIT License
613 stars 340 forks source link

Invalid signature: 0x8080014 when piping from HTTP #73

Open Cyberuben opened 9 years ago

Cyberuben commented 9 years ago

I am getting the following error when running node-unzip in combination with a http.get request, then piping it into node-unzip.

The code I use:

var extractor = unzip.Extract({path: tempPath});
extractor.on("close", function() {
    log.debug("Done downloading "+file);
    callback(null, file);
});
extractor.on("error", function (err) {
    log.error(err);
    callback(err, null);
});

http.get(url, function (res) {
    res.pipe(extractor);
});

tempPath is defined properly, and the said code works fine on Windows. Now, on my CentOS server, it outputs the error like this: invalid signature: 0x8080014

I'm 100% sure the XML file is valid, the exact file works on Windows.

nmehta6 commented 9 years ago

+1

pbochynski commented 9 years ago

Have the same issue on Mac. Strange thing is that if I write http response to the zip file on disk and then process it from file it works.

stream.js:94
  throw er; // Unhandled stream error in pipe.
        ^
 Error: invalid signature: 0x8080014
Cyberuben commented 9 years ago

Same here @pbochynski

izqui commented 9 years ago

+1 :(

dvalentiate commented 9 years ago

Bad news: This repo appears to be abandoned. Good news: https://www.npmjs.com/package/unzip2 patches this problem and streaming of uncompressed zip content.

It comes down to the lines in lib/parse.js:161

setImmediate(function() {
  self._pullStream.unpipe();
  self._pullStream.prepend(extra);
  self._processDataDescriptor(entry);
});

should be

self._pullStream.unpipe();
self._pullStream.prepend(extra);
setImmediate(function() {
  self._processDataDescriptor(entry);
});
woodedlawn commented 9 years ago

Thank you @dvalentiate

snowdream commented 8 years ago

Same here @pbochynski

joswhite commented 8 years ago

Thanks you as well!! unzip2 fixed a similar problem I had in unzipping folders made with the archiver module.

roboshoes commented 8 years ago

Thank you @dvalentiate for the tip. Swichting to unzip2 fixed it for me: :two_men_holding_hands:

tlianglstyle commented 7 years ago

Thank you @dvalentiate for the tip. Swichting to unzip2 fixed it for me: 👬

marcusflat commented 5 years ago

Thanks !!!