ulmo-filter
v0.0.1
Published
use filter to create Transform stream
Downloads
3
Readme
ulmo-filter
Create Transform streams to filter data.
const read = require("fs").createReadStream;
const es = require("event-stream");
const filter = require("ulmo-filter");
const transform = require("ulmo-transform");
// read file.txt and apply transformation to remove blank lines
read("file.txt", {encoding: "utf8"})
.pipe(es.split()) // split on newline
.pipe(filter(line => line)) // filter out empty values
.pipe(transform(function(chunk, done) { // put newlines back in
this.push(chunk);
this.push("\n");
done();
}));
}