Comparing version 0.2.0 to 0.3.0
@@ -85,3 +85,4 @@ var util = require('util'); | ||
this.pull(vars.extraFieldLength).then(extraField => { | ||
var fileSizeKnown = !(vars.flags & 0x08); | ||
var fileSizeKnown = !(vars.flags & 0x08), | ||
eof; | ||
@@ -94,11 +95,13 @@ var inflater = vars.compressionMethod ? zlib.createInflateRaw() : Stream.PassThrough(); | ||
entry.size = vars.uncompressedSize; | ||
this.stream(vars.compressedSize) | ||
.pipe(inflater) | ||
.on('error', e => this.emit('error',err)) | ||
.pipe(entry) | ||
.on('finish', () => this._readRecord()); | ||
eof = vars.compressedSize; | ||
} else { | ||
// TODO - allow pullstream to match | ||
this.emit('error',new Error('MatchStream not implemented')); | ||
eof = new Buffer(4); | ||
eof.writeUInt32LE(0x08074b50, 0); | ||
} | ||
this.stream(eof) | ||
.pipe(inflater) | ||
.on('error', e => this.emit('error',err)) | ||
.pipe(entry) | ||
.on('finish', () => fileSizeKnown ? this._readRecord() : this._processDataDescriptor(entry)); | ||
}); | ||
@@ -105,0 +108,0 @@ }); |
@@ -34,15 +34,32 @@ 'use strict'; | ||
PullStream.prototype.stream = function(len) { | ||
// The `eof` parameter is interpreted as `file_length` if the type is number | ||
// otherwise (i.e. buffer) it is interpreted as a pattern signaling end of stream | ||
PullStream.prototype.stream = function(eof) { | ||
const p = Stream.PassThrough(); | ||
let count = 0; | ||
let count = 0,done,packet; | ||
const pull = () => { | ||
if (this.buffer && this.buffer.length) { | ||
let packet = this.buffer.slice(0,len); | ||
this.buffer = this.buffer.slice(len); | ||
len -= packet.length; | ||
if (typeof eof === 'number') { | ||
packet = this.buffer.slice(0,eof); | ||
this.buffer = this.buffer.slice(eof); | ||
eof -= packet.length; | ||
done = !eof; | ||
} else { | ||
let match = this.buffer.indexOf(eof); | ||
if (match !== -1) { | ||
packet = this.buffer.slice(0,match); | ||
this.buffer = this.buffer.slice(match); | ||
done = true; | ||
} else { | ||
let len = this.buffer.length - eof.length; | ||
packet = this.buffer.slice(0,len); | ||
this.buffer = this.buffer.slice(len); | ||
} | ||
} | ||
p.write(packet); | ||
} | ||
if (len) { | ||
if (!done) { | ||
if (this.flushcb) { | ||
@@ -49,0 +66,0 @@ this.removeListener('chunk',pull); |
{ | ||
"name": "unzipper", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Unzip cross-platform streaming API ", | ||
@@ -28,4 +28,3 @@ "author": "Evan Oxfeld <eoxfeld@gmail.com>", | ||
"bluebird": "^3.4.1", | ||
"fstream": "~1.0.10", | ||
"readable-stream": "~1.0.31" | ||
"fstream": "~1.0.10" | ||
}, | ||
@@ -32,0 +31,0 @@ "devDependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
32209
3
437
0
5
- Removedreadable-stream@~1.0.31
- Removedcore-util-is@1.0.3(transitive)
- Removedisarray@0.0.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedstring_decoder@0.10.31(transitive)