json-length-delimited-stream
v0.2.2
Published
A length-delimited JSON stream parser for TCP frames
Downloads
3
Readme
JSONLengthDelimitedStream
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!
});