Socket
Socket
Sign inDemoInstall

njstream

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    njstream

Newline delimited JSON streaming made easy


Version published
Maintainers
1
Install size
5.98 kB
Created

Readme

Source

NJStream

Newline delimited JSON streaming made easy

Installation

  $ npm install njstream

Examples

Simple usage

var NJStream = require('njstream');
var njstream = new NJStream();

njstream.on('parsed', function(json_data){
  console.log(json_data);
});

for(var i = 0; i < 100000; i++){
  stream.write(JSON.stringify({"foo": "bar"}) + '\r\n');
}

Using superagent

var request = require('superagent')
  , NJStream = require('njstream');

var njstream = new NJStream();

njstream.on('parsed', function(json_data){
  console.log(json_data);
});

request
.get('http://your.server/')
.pipe(njstream);

Passing it to an http request

var http = require('http')
  , NJStream = require('njstream');

var njstream = new NJStream();

njstream.on('parsed', function(json_data){
  console.log(json_data);
});

var request = http.get('your.domain.io/json_delimited_data/');

request.on('response', function(res){
  res.pipe(njstream);
});

Keywords

FAQs

Last updated on 18 Dec 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc