stream-reduce
Reduce stream data to a single value
Last updated 7 years ago by parshap .
Public Domain · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (7 years ago)

4 Versions

  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago

Copyright 2014 - 2016 © taobao.org |