simplified stream construction
Easy way to create a
Stream that is both
- Pass in optional
throughtakes care of pause/resume logic if you use
this.resume()to manage flow.
this.pausedto see current flow state. (
This function is the basis for most of the synchronous streams in event-stream.
var through = require'through'throughthisqueuedata //data *must* not be null//optionalthisqueuenull
Or, can also be used without buffering on pause, use
var through = require'through'throughthisemit'data' data//this.pause()//optionalthisemit'end'
You will probably not need these 99% of the time.
through emits close when the writable
and readable side of the stream has ended.
If that is not desired, set
var through = require'through'//like thisvar ts = throughwrite end autoDestroy: false//or like thisvar ts = throughwrite endtsautoDestroy = false
MIT / Apache2