It's also on my todo list to patch isaacs/readable-stream to make _write and _read support objects cleanly.
On Sun, Dec 23, 2012 at 12:00 PM, Jake Verbaten <rayn...@gmail.com> wrote: > I have not tested _read or _write with objects, I doubt it will work. > > However pipe works with objects and you can overwrite read and write. > > I have base class implementations for readable ( > https://github.com/Raynos/read-stream), writable ( > https://github.com/Raynos/write-stream<https://github.com/Raynos/read-stream>) > and duplex > (https://github.com/Raynos/read-write-stream<https://github.com/Raynos/read-stream> > ). > > There is also a writable stream that buffers the finish event until all > writes are complete ( https://github.com/Raynos/end-stream ) and a > transform stream which is very similar to dominictarr/through and isaacs > Transform ( https://github.com/Raynos/transform-stream ) > > You probably want to use the transform stream as your base class for > streams over objects and want to use isaacs Transform stream for streams > over strings. > > as for your example, I have a module called chain-stream ( > https://github.com/Raynos/chain-stream) to do just that. > > https://gist.github.com/4365684 > > > On Sun, Dec 23, 2012 at 7:27 AM, Dominic Tarr <dominic.t...@gmail.com>wrote: > >> I suggest you checkout Raynos' stream modules, he is mostly used Streams2, >> I think you will be able to find everything you are looking for >> >> >> On Sun, Dec 23, 2012 at 7:20 AM, Arpad Borsos < >> arpad.bor...@googlemail.com> wrote: >> >>> Hi! >>> >>> I’m really excited to read about the new streams2 interfaces. They make >>> a lot of sense when you are dealing with binary/string data. The automatic >>> splice()-ing and join()-ing is awesome. >>> But they kind of fall short when it comes to handling arbitrary objects >>> (these may also be plain strings). >>> >>> Lets just consider that I have a binary Readable stream and I want to >>> pipe it to a Transform stream that parses the binary data into js objects. >>> Later on, I want to read() a single object or read(n) objects. Or maybe >>> even read(0) to read all the objects until 'end'. So the stream interface >>> itself would take care of buffering and the likes. >>> >>> Also the other way around: >>> How can I create a Writable (Transform) stream that serialized arbitrary >>> objects into binary data that I can then just pipe into tcp or onto disk? >>> >>> Other than the streaming parser/serializer, I can also think of complete >>> pipelines that manipulate arbitrary objects in a streaming manner. >>> >>> Something like >>> ``` >>> Readable(…) >>> .pipe(parser()) >>> .pipe(filter('a >= 10')) >>> .pipe(map('a')) >>> .pipe(inGroupsOf(4)) >>> .pipe(sum('a')) >>> .pipe(serializer()) >>> .pipe(…) >>> ``` >>> >>> Note that those “arbitrary objects” might be strings or Buffers >>> themselves. >>> >>> So any pointers on how to achieve such a thing with streams2 would be >>> much appreciated. >>> -Arpad >>> >>> -- >>> 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 nodejs@googlegroups.com >>> To unsubscribe from this group, send email to >>> nodejs+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >> >> -- >> 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 nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en