node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

json-duplex-stream

json-duplex-stream

Build Status

Newline-separated JSON duplex stream

Install

$ npm i json-duplex-stream --save

Require

var JSONDuplexStream = require('json-duplex-stream');

Instantiate

var stream = JSONDuplexStream();

Pipe

Pipe input to stream.in and output from stream.out.

var stream = JSONDuplexStream();
in.pipe(stream.in).pipe(app).pipe(stream.out).pipe(out);

Handle protocol errors

stream.in.on('error', function(err) {
  // ... 
});
 
stream.out.on('error', function(err) {
  // ... 
});

License

MIT