2.0.0 • Published 5 years ago

ndjson v2.0.0

Weekly downloads
292,555
License
BSD-3-Clause
Repository
github
Last release
5 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

nodejs-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-cli@everything-registry/sub-chunk-2252@saperiuminc/zwarm-clienttap-jsontcp-log-clienttenderminttendermint-insecurewikipathways-api-clientwms-unique-holdswiki-plugin-datscriptstasksvalbardsuperlevelvo-unpkgvisualize-airport-util-wifi-scanvbb-tripsvbb-clientvbb-platform-patternsvbb-staticvbb-change-positionsvbb-linesvandelay@distinction-dev/ndjson-helpers@connor-davis/hyvpn-protocol@connor-davis/dropzone-protocol@coveo/raptor-corejest-benchjulien76-pouchdb-replication-streamjson-write-streamjson-print-streamjsonmapk8s-super-clientjson-damjskos-clijson-anystreamipfs-apiipfs-cluster-apiipfs-api-with-timeoutsipfs-cluster-api-remove-namejson2po-streamkaaviojsonstatskuzzlekuzzle-clistrava-pr-effortsstrava-segment-effortsspreadstreamstatic-web-archive-on-gitsqlite-searchsurveiltgsoundcloud-searchubjson-streamtimeld-clitimeld-gatewaytitotito-apitito-gender-ratiotranslate-field-to-sanitytrimet-live-archivetravelbybit-binance-sdktiny-event-sourcing@antodip/timeseries@amidmm/javascript-sdk@avsssai/unpkg-server@agoric/tendermint@aleen42/csv-parser@backstage/plugin-search-backend-node@balena/open-balena-api@ban-team/adresses-cadastre@bitexchange-ltd/bitxchange-server@bitexchange-ltd/lamassu-server-beta@bithighlander/javascript-sdk-patch@bithighlander/binance-js-sdk@bnb-chain/javascript-sdk@bluelinklabs/ctzn-server@binance-chain/javascript-sdk@budibase/pouchdb-replication-stream@ca9io/electron-eval@chcaa/zendesk-scraper@acentswap/bridge-sdk5984@derhuerst/redis-streamyoutube-metadata-clixo-serverwant-have-replicationview-geojsonunique-columnsunpkg-servervalid-recordsupmon-mailupmon-smszimmer
2.0.0

5 years ago

1.5.0

8 years ago

1.4.4

8 years ago

1.4.3

9 years ago

1.4.2

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.3

11 years ago

1.2.2

11 years ago

1.2.1

11 years ago