I made a 'class' that connects to a stream and emits JSON objects. It 
implements EventEmitter and emits events like 'object', 'error', etc.
I would like to convert my class into a Readable stream because it will be 
useful to use the pipe method. How can I do that?

Is this enough?

function MyClass() {}
util.inherits(MyClass, require('stream'))
MyClass.prototype.pause = function() {...}
MyClass.prototype.resume = function() {...}
...

But what if I want a writable stream, it should not have the pipe method. 
Which is the cleanest way of implementing your own streams?

Thanks.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to