New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

njstream

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

njstream

Newline delimited JSON streaming made easy

Source
npmnpm
Version
0.0.2
Version published
Weekly downloads
5
-28.57%
Maintainers
1
Weekly downloads
 
Created
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

stream

FAQs

Package last updated on 06 Sep 2012

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