parse-json-stream

2.4.0 • Public • Published

code style downloads license npm version

parse-json-stream

Stream-JSON parser.

Parser for large streams of json data, allows processing objects asynchronously

Usage

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

let parser = new Parser(function (error, object) {
	if (error) {
		console.log(error.message);
	} else if (object) {
		console.log(object);
	} else {
		console.log('done');
	}
});

Then call it on every new chunk of data, i.e. the async request, e.g.

const https = require("https");

https.get(url, res => {
	res.on("data", data => {
		parser.parse(data);
	});
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.4.0
    6
    • latest

Version History

Package Sidebar

Install

npm i parse-json-stream

Weekly Downloads

6

Version

2.4.0

License

MIT

Unpacked Size

4.05 kB

Total Files

4

Last publish

Collaborators

  • diogoeichert