2.0.0 • Published 4 years ago

ndjson v2.0.0

Weekly downloads
292,555
License
BSD-3-Clause
Repository
github
Last release
4 years ago

ndjson

Streaming newline delimited json parser + serializer. Available as a JS API and a CLI.

NPM

Usage

const ndjson = require('ndjson')

ndjson.parse(opts)

Returns a transform stream that accepts newline delimited json buffers and emits objects of parsed data.

Example file:

{"foo": "bar"}
{"hello": "world"}

Parsing it:

fs.createReadStream('data.txt')
  .pipe(ndjson.parse())
  .on('data', function(obj) {
    // obj is a javascript object
  })
Options
  • strict can be set to false to discard non-valid JSON messages
  • All other options are passed through to the stream class.

ndjson.stringify(opts)

Returns a transform stream that accepts JSON objects and emits newline delimited json buffers.

example usage:

var serialize = ndjson.serialize()
serialize.on('data', function(line) {
  // line is a line of stringified JSON with a newline delimiter at the end
})
serialize.write({"foo": "bar"})
serialize.end()
Options

Options are passed through to the stream class.

LICENSE

BSD-3-Clause

balena-clibalena-sdk@balena/open-balena-apinodejs-k8s-client.git@bitrelay/discoverysanity-dataset-manipulationbalena-sdk-for-pkg@bitexchange-ltd/bitexchange-server-7.5.0-beta.3@dattomy/docker-registry-serveryongguidap-clidata-access-platform-cliscrewdriver-api@everything-registry/sub-chunk-2252@saperiuminc/zwarm-clientyoutube-metadata-cliwant-have-replicationwikipathways-api-clienttimeld-gatewaytimeld-clitiny-event-sourcingtitotito-apitito-gender-ratiotenderminttendermint-insecure@frattaro/unpkg-serverzimmerunpkg-serverupmon-mailupmon-smsvalid-recordsubjson-streamvo-unpkgview-geojsonvisualize-airport-util-wifi-scanvandelayvbb-tripsvbb-staticvbb-change-positionsvbb-clientvbb-linesvbb-platform-patternstrimet-live-archivetravelbybit-binance-sdktranslate-field-to-sanityunique-columns@hatsa/pubsub@irisnet/gaia-sdk@irisnet/irishub-sdktap-jsontcp-log-client@etalab/adresses-cadastre@haad/ipfs-api@hankei6km/repositioncitations-and-tweets-by-yearcitations-by-year-and-tweetsclussh@derhuerst/redis-streamocrio-ipfs-http-clientclioada@distinction-dev/ndjson-helpersopen-prscolorwalletcomby-wrappercktestpackage1profferdb-stations-clidb-stationsrandom-json-streamdonejs-streaming-dev-serverpxpdeploy-from-npmraptor-compareraptor-submitraptor-testraptor-parsedict-cc-clidigger-httpqueryable-lograf-loggerreact-upresin-sdkred-maplerecord-hafas-datarecord-ice-movementrecord-tgv-movementrecord-vbb-delaysrifi-loadreproject-streamrhxrunstreamseneca-transportseneca-transport-ngseneca-transport-zhsandblock-chain-sdk-jsschachnovellescrewdriver-cd-apirock-paper-scissors-lizard-spock-streamrock-paper-scissors-stream
2.0.0

4 years ago

1.5.0

7 years ago

1.4.4

7 years ago

1.4.3

8 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago