stream-filter
Filter data passed through
Last updated 8 years ago by parshap .
Public Domain · Repository · Bugs · Original npm · Tarball · package.json
$ npm install stream-filter 
SYNC missed versions from official npm registry.

stream-filter

Filter data using a through stream.

build status

Installation

npm: stream-filter

npm install stream-filter

Example

var filter = require("stream-filter");

process.stdin.pipe(filter(function(data) {
	return data.length > 2;
})).pipe(process.stdout);

Async Filter Function

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);

API

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.

Current Tags

  • 2.1.0                                ...           latest (8 years ago)

3 Versions

  • 2.1.0                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

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