stream-events
Get an event when you're being sent data or asked for it.
About
This is just a simple thing that tells you when _read
and _write
have been called, saving you the trouble of writing this yourself. You receive two events reading
and writing
-- no magic is performed.
This works well with duplexify or lazy streams, so you can wait until you know you're being used as a stream to do something asynchronous, such as fetching an API token.
Use
$ npm install --save stream-events
var stream = var streamEvents = var util = { streamDuplex streamEvents}util MyStreamprototype { console this this} MyStreamprototype { console} var stream = stream stream stream
Using with Duplexify
var duplexify = var streamEvents = var fs = var dup = dup fs