sfcode
An Online Competing and Development Environment
|
#through
Easy way to create a Stream
that is both readable
and writable
.
write
and end
methods.through
takes care of pause/resume logic if you use this.queue(data)
instead of ‘this.emit('data’, data).
Use
this.pause()and
this.resume()to manage flow.
Check
this.paused<tt>to see current flow state. (writealways returns
!this.paused`).This function is the basis for most of the synchronous streams in event-stream.
Or, can also be used without buffering on pause, use ‘this.emit('data’, data)‘, and this.emit('end’)
You will probably not need these 99% of the time.
By default, through
emits close when the writable and readable side of the stream has ended. If that is not desired, set autoDestroy=false
.
MIT / Apache2