stream-reduce

1.0.3 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    1,475
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    1,475
  • 1.0.2
    0
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i stream-reduce

Weekly Downloads

1,140

Version

1.0.3

License

Public Domain

Last publish

Collaborators

  • parshap