1.0.5 • Published 11 years ago
transform-parse v1.0.5
transform-parse
A transform stream that parses an incoming stream as JSON.
Installation
$ npm install transform-parse --saveExample
var stream = require('stream');
var parse = require('transform-parse');
var source = stream.PassThrough();
var dest = stream.PassThrough({ objectMode: true });
source.pipe(parse()).pipe(dest);
source.end(new Buffer('{ "foo": "bar" }'));
dest.on('data', function(obj){
// => { foo: 'bar' }
console.log(obj);
});API
var parse = transformParse()
Initialise a new TransformParse.
Testing
$ npm run test-specTo generate a coverage report:
$ npm run test-cov
