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

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-datscriptsheet-t-apisheet-to-apisheet-42-apisandblock-chain-sdk-jsscrewdriver-apiscrewdriver-cd-apischachnovellereproject-streamresin-sdkrock-paper-scissors-lizard-spock-streamrock-paper-scissors-streamstaskseneca-transportseneca-transport-ngseneca-transport-zhrunstreamsvalbardsuperlevelvo-unpkgvisualize-airport-util-wifi-scanvbb-tripsvbb-clientvbb-platform-patternsvbb-staticvbb-change-positionsvbb-linesvandelaymime-type-streammininetmeshliblogsmithjslichess-nodegroq-cligodot2jest-benchjsonmapjsonstatsjson-print-streamjson-write-streamjson2po-streamhyperpipeipfs-cluster-apiipfs-cluster-api-remove-nameipfs-api-with-timeoutsinput-streammcps-sdk-jsmicrowizardjulien76-pouchdb-replication-streamkourouksqldb-rx-clientkuzzlekuzzle-cligtfs-to-fptfhtml-table-streamhumble-event-storehyperdrive-haushyperemitterhyper-ndjsonimsimport-npm-to-mongodbgossip-cyclongpml2pvjsonhafas-discover-stationshafas-record-delaysk8s-super-clientkaaviojson-damjskos-clijson-anystreamhello_test_npm_hts_elsehomebridge-beoplayldjson-keysldjson-to-couchdblamassu-configsipfs-apimapfilter-servermapstreamermav-stationsnode-ws-captpnodus-frarmeworkos-x-contactsosm-flatten-relation
2.0.0

4 years ago

1.5.0

8 years ago

1.4.4

8 years ago

1.4.3

9 years ago

1.4.2

9 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

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago