Socket
Socket
Sign inDemoInstall

concatjson

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concatjson

concatenated JSON streaming parser/serializer


Version published
Weekly downloads
196
increased by64.71%
Maintainers
1
Weekly downloads
 
Created
Source

concatjson

npm travis

Standard JavaScript

Inspired by https://github.com/maxogden/ndjson

concatjson is concatenated JSON streaming parser/serializer for Node.js.

Install

npm i concatjson

Usage

concatjson.parse()

  • @return {Stream.Transform} a Transform stream

parses concatenated JSON stream and emits javascript objects.

somefile (contains concatenated JSON objects)

{"foo":"bar"}{"qux":"corge"}{"baz":{"waldo":"thud"}}
const fs = require('fs')
const cj = require('concatjson')

fs.createReadStream('./somefile')
  .pipe(cj.parse())
  .on('error', err => console.error(err))
  .on('data', obj => {
    // obj is a js object
  })

concatjson.serialize()

alias: concatjson.stringify()

accepts objects and emits stringified JSON objects.

const cj = require('concatjson')
const ser = cj.serialize()
ser.write({foo: 'bar'})
ser.end()
ser.on('data', dat => {
  // dat is stringified JSON
})

License

MIT

Keywords

FAQs

Package last updated on 25 Jan 2018

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc