json-stream-parse

1.0.3 • Public • Published

json-stream-parse

Emits JSON objects/arrays from a Buffer stream.

const Parser = require("json-stream-parse"),
    net = require("net");

const parser = new Parser(),
    socket = new net.Socket();

parser.on("json", (json) => {
    console.log(json);
});

socket.connect(8888, '127.0.0.1', () => {
    socket.pipe(parser);
})

Events

json-stream-parser is a Writeable stream that emits only one event, json. This event is emitted any time a valid JSON object or array is found within the stream. Any data that is found to be invalid JSON is ignored.

License

MIT

Package Sidebar

Install

npm i json-stream-parse

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

11.6 kB

Total Files

5

Last publish

Collaborators

  • brtthomp