Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Reduce stream data to a single value
JavaScript
branch: master

1.0.3

latest commit acb6a3ab78
@parshap authored
Failed to load latest commit information.
.gitignore Add tests
README.md Remove trailing whitespace
example.js Add example
index.js Pass tests
package.json 1.0.3
test.js Add tests

README.md

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
Something went wrong with that request. Please try again.