minipass
Advanced tools
Comparing version 3.1.2 to 3.1.3
33
index.js
@@ -137,3 +137,2 @@ 'use strict' | ||
if (!this.objectMode && !chunk.length) { | ||
const ret = this.flowing | ||
if (this[BUFFERLENGTH] !== 0) | ||
@@ -143,3 +142,3 @@ this.emit('readable') | ||
cb() | ||
return ret | ||
return this.flowing | ||
} | ||
@@ -158,12 +157,20 @@ | ||
try { | ||
return this.flowing | ||
? (this.emit('data', chunk), this.flowing) | ||
: (this[BUFFERPUSH](chunk), false) | ||
} finally { | ||
if (this.flowing) { | ||
// if we somehow have something in the buffer, but we think we're | ||
// flowing, then we need to flush all that out first, or we get | ||
// chunks coming in out of order. Can't emit 'drain' here though, | ||
// because we're mid-write, so that'd be bad. | ||
if (this[BUFFERLENGTH] !== 0) | ||
this.emit('readable') | ||
if (cb) | ||
cb() | ||
} | ||
this[FLUSH](true) | ||
this.emit('data', chunk) | ||
} else | ||
this[BUFFERPUSH](chunk) | ||
if (this[BUFFERLENGTH] !== 0) | ||
this.emit('readable') | ||
if (cb) | ||
cb() | ||
return this.flowing | ||
} | ||
@@ -292,6 +299,6 @@ | ||
[FLUSH] () { | ||
[FLUSH] (noDrain) { | ||
do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]())) | ||
if (!this.buffer.length && !this[EOF]) | ||
if (!noDrain && !this.buffer.length && !this[EOF]) | ||
this.emit('drain') | ||
@@ -298,0 +305,0 @@ } |
{ | ||
"name": "minipass", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "minimal implementation of a PassThrough stream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -50,2 +50,9 @@ # minipass | ||
- [minipass-fetch](http://npm.im/minipass-fetch) | ||
- [pacote](http://npm.im/pacote) | ||
- [make-fetch-happen](http://npm.im/make-fetch-happen) | ||
- [cacache](http://npm.im/cacache) | ||
- [ssri](http://npm.im/ssri) | ||
- [npm-registry-fetch](http://npm.im/npm-registry-fetch) | ||
- [minipass-json-stream](http://npm.im/minipass-json-stream) | ||
- [minipass-sized](http://npm.im/minipass-sized) | ||
@@ -228,3 +235,3 @@ ## Differences from Node.js Streams | ||
tee.pipe(dest2) | ||
stream.pipe(tee) // tee gets 'foo', pipes to both locations | ||
src.pipe(tee) // tee gets 'foo', pipes to both locations | ||
``` | ||
@@ -231,0 +238,0 @@ |
37205
467
614