1.0.0 • Published 8 years ago

filter-stream2 v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

Filter A Stream Of Data

NPM Version NPM Downloads js-happiness-style

Install

$ npm install --save filter-stream2

Usage

var filterStream = require('filter-stream2');

createAReadStream().pipe(filterStream(function (chunk, enc, done) {
	// Some test on the chunk
	if (chunk.indexOf('some string i am looking for ...?') !== -1) {
		// Pass this chunk downstream
		return done(true);
	}

	// Otherwise dont pass this chunk down
	done(false);
}));

// Other methods
filterStream.sync(); // Just a sync version where you return true/false
filterStream.obj(); // Object stream version
filterStream.objSync(); // Sync version of object stream