GT2/GT2-Android/node_modules/logfmt/examples/through.js

17 lines
327 B
JavaScript
Raw Normal View History

var through = require('through');
var logfmt = require('../logfmt')
process.stdin
.pipe(through(function(data){
if(/foo/.test(data)){
this.queue(data);
}else{
process.stderr.write('discard ' + data);
}
}))
.pipe(logfmt.streamParser())
.pipe(through(function(obj){
console.log(obj);
}))