Ninja Programmers Mindmeld
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    stream-reducepublic

    stream-reduce

    Like Array.prototype.reduce but for streams. Given a sync reduce function and an initial value it will return a through stream that emits a single data event with the reduced value once the input stream ends.

    Example

    var reduce = require("stream-reduce");
     
    process.stdin.pipe(reduce(function(acc, data) {
        return acc + data.length;
    }, 0)).on("data", function(length) {
        console.log("stdin size:", length);
    });

    Installation

    npm install stream-reduce
    

    Keywords

    install

    npm i stream-reduce

    Downloadsweekly downloads

    2,309

    version

    1.0.3

    license

    Public Domain

    homepage

    github.com

    last publish

    collaborators

    • avatar