Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upIs objectMode a replacement? #30
Comments
This comment has been minimized.
This comment has been minimized.
|
so, I pretty much never use event-stream any more. the most useful thing to come out of it is
This usually isn't a big deal with the sort of things you want object streams for, anyway. also note, that since streams2 buffers automatically, if you don't actually want to read from a stream, http.createServer(req, res) {
req.resume() //drop anything
res.end('hello')
})win some, loose some... |
This comment has been minimized.
This comment has been minimized.
joliss
commented
May 4, 2013
|
Very cool, thanks for elucidating! :) |
joliss
closed this
May 4, 2013
This comment has been minimized.
This comment has been minimized.
joliss
commented
May 8, 2013
|
For posterity: It seems I misunderstand the purpose of the event-stream library. It's just a loose collection of stream functions (rather than an object-based stream like I thought for some reason). As substack pointed out to me, for sequences of objects, a better alternative to streams (or the |
This comment has been minimized.
This comment has been minimized.
|
streams2 has changed things a bit, but when this library was first written, all the node stream stuff worked equally with streams of objects, and streams of text. In streams2 you have to explicitly declare that a stream is an object stream, else it will attempt to concatenate chunks, which of course, must be strings or buffers. event-stream is indeed a collection of stream functions - mostly intended for streams of objects. I argue against just using event emitters, because, once you have a few things connected together, and you need to handle some edge cases - like errors, or the end of messages, or disconnections, then you pretty much need a In node 0.4, 0.6, 0.8 the same If you just use an event emitter then you'll only end up reinventing the Incidentally, I use this now https://github.com/dominictarr/pull-stream it's much simpler that streams2, and much more powerful for object streams. |
joliss commentedMay 4, 2013
Node's stream API as of nodejs/node-v0.x-archive@444bbd4 has a (somewhat under-documented) objectMode flag. Do you know if this a replacement for event-stream?
I need something like event-stream for my library, and now I'm unsure which one I should use.