template-stream

0.1.8 • Public • Published

template-stream

Template Stream

Install

npm install template-stream

Usage

Building your own streams

tStream = new require('template-stream')({ jsonOut: 'auto', filterErrors: false, appendString: '' }) // default config
tStream.bind('onTransform', function(data) {
    // do your processing here
    return data // return data to be pushed down stream, return undefined to filter the data
})

Config

jsonOut json true/false string output down stream. 'auto' = same form as upstream filterErrors false=json parse errors emit the error, true=json parse errors are silently filtered

Statistics

// all
console.log(tStream.stat()) // { processed: 942, filtered: 18, badJson: 2 }
 
// particular statistic
console.log(tStream.stat('filtered')) // 18
 
// your own statistics
tStream.bump('myStat')
console.log(tStream.stat()) // { processed: 942, filtered: 18, badJson: 2, myStat: 1 }

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i template-stream

Weekly Downloads

4

Version

0.1.8

License

none

Last publish

Collaborators

  • angleman