Simple base class for duplex streams, that automatically handles pausing and buffering.
var duplex =var d =
write(data) is called.
end() is called
data to the output buffer.
'data' will be emitted if the stream is not paused.
Cap the output buffer. no more data events may be added.
'end' will be emitted after the buffer drains,
or immediately, if the stream is unpaused.
Pause the readable side of the stream.
This will prevent it from emitting 'data' or or 'end' until resume is called.
Unpause the readable side of the stream.
This will allow it to emit
If there there is any data in the output buffer,
It will start draining immediately.
Pause the writable side of the stream. this will cause write() to return false, so any streams piping into this stream will pause after thier next write.
Unpause the writable side of the stream. This will cause
Stream#pipe to call
on any streams piping to this stream.
destroy() is called automatically after both sides of the stream have ended.
write()==false after the stream emits
write()==true after the stream emits
The user is responsible for emitting
resume() will be called on
pause() was called manually.
resume() is manually called before the
nextTick, the stream will start emitting data
MIT / APACHE 2