0.1.0 • Published 11 years ago
json-parser-stream v0.1.0
JSON Parser Stream
Parse a readable stream of json strings into javascript objects
Installation
npm install -S json-parser-stream
Usage
Create an instance of linestream and pipe a readable stream into that instance
var JSONParserStream = require('json-parser-stream')
// parser is an instance of require('stream').Transform
var opts = {
highWaterMark: 2
}
var parser = new JSONParserStream(opts) // opts is optional
var readStream = {} // a stream of single json strings per data event
var parser = readStream.pipe(splitter)
parser.on('data', function(chunk) {
console.dir(chunk) // no line breaks here :)
})
parser.on('finish', function() {
console.log('finish event called, all json items read')
})