0.1.8 • Published 10 years ago

template-stream v0.1.8

Weekly downloads
22
License
-
Repository
-
Last release
10 years ago

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

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago