$ npm install stream-filter
Filter data using a through stream.
npm install stream-filter
var filter = require("stream-filter");
process.stdin.pipe(filter(function(data) {
return data.length > 2;
})).pipe(process.stdout);
var filter = require("stream-filter");
process.stdin.pipe(filter.async(function(data, callback) {
doAsyncThing(data, function(err, size) {
callback(err, size > 2);
});
})).pipe(process.stdout);
var filter = require("stream-filter");
filter(fn, options);
filter.obj(fn, options);
filter.async(fn, options);
filter.async.obj(fn, options);
Note that filter.obj(fn)
and filter.async.obj(fn)
are convenience
wrappers to pass { objectMode: true }
.
See index.js and test.js for API details.
© 2010 - cnpmjs.org x YWFE | Home | YWFE