Skip to content

parshap/node-stream-reduce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Reduce stream data to a single value

Resources

Stars

Watchers

Forks

Packages

No packages published