🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

readline-json

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readline-json

Wrapper around readline that emits parsed json objects.

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

readline-json

Wrapper around readline that extracts JSON objects from the input stream and emits json events per object found.

var readline_json = require('readline-json');
readline_json(process.stdin).on('json', function(json) {
  // handle json object
});

The library supports single-line and multi-line jsons in one stream, e.g.:

echo '{}
{
  "a": 1
}
{"b":2}' | node myscript.js

Which will emit three json events: {}, {"a":1} and {"b":2}.

TODO

  • Add tests
  • Improve error reporting
  • Support multiple JSON objects in one line

FAQs

Package last updated on 20 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts