Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 586 Bytes

File metadata and controls

15 lines (12 loc) · 586 Bytes

JSONLengthDelimitedStream Build Status

Wraps a TCP Socket with a length-delimited JSON frame as a readable stream.

Usage

const jsonLengthDelimitedStream = new JSONLengthDelimitedStream(tcpSocket, { frameLengthInBytes: 4 });

jsonLengthDelimitedStream.on('data', (object) => {
  /// do whatever you will with the object!
});

jsonLengthDelimitedStream.on('end', () => {
  // the socket has closed!
});