Interesting. Always like to see new stream modules.

On Saturday, June 23, 2012 3:23:26 AM UTC-7, Boris Egorov 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 [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