Suppose I have created a transform stream called Parser
which can be written to like a normal stream but is read from as an object stream. I am using the readable
event for the code that uses this transform stream:
var parser = new Parser();
parser.on('readable', function () {
var data = parser.read();
console.log(data);
});
In this event handler, must I repeatedly call parser.read()
? Or, will readable
fire on its own for every single object being pushed from my transform stream?