there is a bug in your ReduceStream.
streams are immutable, so you'll need be able to return the new total.
modifying it will create a new string.

in all my messing around with this stuff, the most useful function
I've made is this:

https://github.com/dominictarr/event-stream/blob/master/index.js#L17-71

it just creates a simple ReadableWritableStream, and you can pass in
custom write and end functions. sensible default implementations of
pause, resume, and destroy are included.

it sets writable and readable for you, and always emits 'close' etc.

I'm in the process of refactoring the rest of my stream functions to
be interms of es.through()

On Sun, Jun 24, 2012 at 12:20 AM, José F. Romaniello
<jfromanie...@gmail.com> wrote:
> I started something like this few weeks ago nothing there yet but the readme
> file ( readme driven development).
>
> https://github.com/jfromaniello/funstream
>
>
>
> El sábado, 23 de junio de 2012, dolphin 278 escribió:
>
>> Thanks for your reply Dominic i am in the middle of implementing those
>> functions. I'll use your information. Thanks again.
>> ---------
>> Boris Egorov
>> skype/gtalk/nickname: dolphin278
>> mobile: +7 905 728 1543
>>
>>
>> On Sat, Jun 23, 2012 at 3:24 PM, Dominic Tarr <dominic.t...@gmail.com>
>> wrote:
>>
>> I have a collection of functions similar to this here:
>>
>> https://github.com/dominictarr/event-stream
>>
>> you need to add `destroy`, and should add `pause` and `resume`.
>>
>> this may be helpful: https://gist.github.com/2850882
>>
>> it's my best effort at defining the correct behaviour for streams,
>> such that pipe will work correctly.
>> it's not official of course, its just constructed from
>> reading node/lib/stream.js and so on, and figuring it out.
>>
>> cheers, Dominic
>>
>> On Sat, Jun 23, 2012 at 10:23 PM, dolphin 278 <dolphin...@gmail.com>
>> wrote:
>> > Good day
>> >
>> > I did not found any modules to easily wrap any function to stream
>> > interface,
>> > so i made my own. Point is to have an option to pipe streams to
>> > different
>> > filters and transformations, without describing stream interface from
>> > scratch every time.
>> >
>> > Usage:
>> >>
>> >> var FuncWrapper = require('pipemaster').FuncWrapper,
>> >>     streamFunc;
>> >> function asyncExample(x, callback) {
>> >>    callback(null, x * x); // first argument is an optional error.
>> >> }
>> >> streamFunc = new FuncWrapper(asyncExample);
>> >> streamFunc.write(2);  // streamFunc emits '4'
>> >> streamFunc.write(6);  // streamFunc emits '36'
>> >
>> >
>> > There is another class for easy filtering, called StreamFilter for em,
>> > easy
>> > filtering :)
>> >>
>> >> var StreamFilter = require('pipemaster').StreamFilter,
>> >>     streamFunc;
>> >> function filterAsync(item, callback) {
>> >>     callback(null, item === 4);
>> >> }
>> >> streamFunc = new StreamFilter(filterAsync, true);
>> >> streamFunc.write(1);
>> >> streamFunc.write(4);
>> >> streamFunc.write(2);
>> >> // streamFunc emits only '4'
>> >
>> >
>> > Installation, as always - npm install pipemaster, github link
>> > - https://github.com/dolphin278/pipemaster/
>> >
>> > Hope it would be helpful for someone :)
>> > ------
>> > Boris Egorov
>> > skype/gtalk/nickname: dolphin278
>> > mobile: +7 905 728 1543
>> >
>> > --
>> > 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

-- 
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

Reply via email to