through-json

1.1.0 • Public • Published

through-json

Through stream that parses each write as a JSON message.

npm install through-json

build status

Usage

var parse = require('through-json');
 
// parse returns a streams2 through stream
 
var p = parse();
 
p.on('data', function(data) {
    console.log(data.message);
});
 
p.on('end', function() {
    console.log('no more messages');
});
 
// each write must be a complete JSON message
 
p.write('{"message":"test"}');
p.write('{"message":"another test"}');
p.end();

Running the above program produces the following output

test
another test
no more messages

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    221
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    221
  • 1.0.1
    0
  • 1.0.0
    9
  • 0.1.1
    0
  • 0.1.0
    1

Package Sidebar

Install

npm i through-json

Weekly Downloads

231

Version

1.1.0

License

none

Last publish

Collaborators

  • mafintosh