stream-reduce
Reduce stream data to a single value
Last updated 13 years ago by parshap .
Public Domain · Repository · Bugs · Original npm · Tarball · package.json
$ npm install stream-reduce 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.3                                ...           latest (13 years ago)

4 Versions

  • 1.0.3                                ...           13 years ago
  • 1.0.2                                ...           13 years ago
  • 1.0.1                                ...           13 years ago
  • 1.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 41
Today 0
This Week 5
This Month 26
Last Day 2
Last Week 5
Last Month 12
Dependencies (1)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE