parse-concat-stream
The simplest possible combination of concat-stream and native JSON.parse
. It provides callback interface just like concat-stream does and accepts custom parser functions.
Example
> ; "foo": 1 "bar": 2 3
Custom parser:
> var { return string || ; };> ;"message"
API
parseConcat([opts], cb(err, data))
Return a writable stream, run cb
once it closes.
data
is JSON.parse
d by default, unless custom opts.parse
is provided.
null
is a shorthand for the identity function, so that
parseConcat({ parse: null }, cb);
is equivalent to
require('concat-stream')({ encoding: 'string' }, cb.bind(null, null));
Option | Type | Required? | Default |
---|---|---|---|
parse | function(string) | No | JSON.parse |
Install
npm install parse-concat-stream
License
MIT