Comparing version 0.7.4 to 0.7.5
@@ -16,3 +16,3 @@ module.exports = Extract; | ||
Parse.call(self); | ||
Parse.call(self,opts); | ||
@@ -19,0 +19,0 @@ self.on('entry', function(entry) { |
@@ -47,4 +47,15 @@ var util = require('util'); | ||
self._readFile(); | ||
else if (signature === 0x02014b50) | ||
self._readCentralDirectoryFileHeader(); | ||
else if (signature === 0x02014b50) { | ||
// Hack to (optionally) bypass central directory at the end | ||
// A proper fix would be to debug invalid signature 0x6064b50 | ||
if (self._opts.bypassDirectory) { | ||
self.__ended = true; | ||
self.stream(Infinity).pipe(NoopStream()).on('finish',function() { | ||
self.end(); | ||
self.push(null); | ||
}); | ||
} | ||
else | ||
self._readCentralDirectoryFileHeader(); | ||
} | ||
else if (signature === 0x06054b50) | ||
@@ -125,2 +136,24 @@ self._readEndOfCentralDirectoryRecord(); | ||
self.pull(vars.extraFieldLength).then(function(extraField) { | ||
var extra = binary.parse(extraField) | ||
.word16lu('signature') | ||
.word16lu('partsize') | ||
.word64lu('uncompressedSize') | ||
.word64lu('compressedSize') | ||
.word64lu('offset') | ||
.word64lu('disknum') | ||
.vars; | ||
if (vars.compressedSize === 0xffffffff) | ||
vars.compressedSize = extra.compressedSize; | ||
if (vars.uncompressedSize === 0xffffffff) | ||
vars.uncompressedSize= extra.uncompressedSize; | ||
if (self._opts.verbose) | ||
console.log({ | ||
filename:fileName, | ||
vars: vars, | ||
extra: extra | ||
}); | ||
var fileSizeKnown = !(vars.flags & 0x08), | ||
@@ -127,0 +160,0 @@ eof; |
@@ -9,3 +9,3 @@ var Stream = require('stream'); | ||
function parseOne(match) { | ||
function parseOne(match,opts) { | ||
var inStream = Stream.PassThrough({objectMode:true}); | ||
@@ -33,3 +33,3 @@ var outStream = Stream.PassThrough(); | ||
inStream.pipe(Parse()) | ||
inStream.pipe(Parse(opts)) | ||
.pipe(transform) | ||
@@ -36,0 +36,0 @@ .on('finish',function() { |
@@ -18,6 +18,4 @@ var Stream = require('stream'); | ||
self.on('finish',function() { | ||
self.finished = true; | ||
self.emit('chunk',false); | ||
process.nextTick(function() { | ||
self.finished = true; | ||
}); | ||
}); | ||
@@ -81,3 +79,3 @@ } | ||
if (!done) { | ||
if (self.finished) { | ||
if (self.finished && !this.__ended) { | ||
self.removeListener('chunk',pull); | ||
@@ -84,0 +82,0 @@ p.emit('error','FILE_ENDED'); |
{ | ||
"name": "unzipper", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "Unzip cross-platform streaming API ", | ||
@@ -5,0 +5,0 @@ "author": "Evan Oxfeld <eoxfeld@gmail.com>", |
@@ -20,2 +20,7 @@ # unzipper [![Build Status](https://api.travis-ci.org/ZJONSSON/node-unzipper.png)](https://api.travis-ci.org/ZJONSSON/node-unzipper) | ||
## Options | ||
The following options can be passed to the parser: | ||
* `verbose : boolean` - logs information to screen | ||
* `bypassDirectory : boolean` - stop parsing when we reach the central directory | ||
## Quick Examples | ||
@@ -22,0 +27,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44226
703
144
9
30