File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11# buffer-peek-stream changelog
22
3+ ## 0.1.2 (2014/11/07)
4+
5+ - fix data being emitted out of order on a large peeked stream
6+
37## 0.1.1 (2014/11/05)
48
59 - fix typo in require
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ BufferPeekStream.prototype.__stopPeeking = function __stopPeeking() {
5656 // unpipe from upstream
5757 this . __src . unpipe ( this ) ;
5858
59+ //TODO: find out if this stream can still get data after unpiping under any circumstance
60+
5961 var buffer = Buffer . concat ( this . __buffer ) ;
6062 var source = this . __src ;
6163
@@ -78,16 +80,10 @@ BufferPeekStream.prototype.__stopPeeking = function __stopPeeking() {
7880 source . _readableState . emittedReadable = true ;
7981 source . _readableState . readableListening = false ;
8082 source . _readableState . readingMore = false ;
81-
82- source . unshift ( buffer ) ;
83- } else {
84- // delay unshifting all chunks back onto parent until we're drained so we don't lose chunks that
85- // have already been put onto the event stack before we unpiped.
86- this . once ( 'drain' , function ( ) {
87- source . unshift ( buffer ) ;
88- } ) ;
8983 }
9084
85+ source . unshift ( buffer ) ;
86+
9187 // we don't need to keep the original buffers
9288 this . __buffer = null ;
9389} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " buffer-peek-stream" ,
3- "version" : " 0.1.1 " ,
3+ "version" : " 0.1.2 " ,
44 "description" : " Transform stream that lets you inspect the start of a ReadStream before deciding what to do with it" ,
55 "main" : " lib/index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments