{"_id":"jsonstream-next","_rev":"6-cbb25a483c47f81a8d08e867a8e47bf9","name":"jsonstream-next","dist-tags":{"latest":"3.0.0"},"versions":{"1.4.0":{"name":"jsonstream-next","version":"1.4.0","description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"http://github.com/contra/JSONStream","repository":{"type":"git","url":"git://github.com/contra/JSONStream.git"},"license":"(MIT OR Apache-2.0)","keywords":["json","stream","streaming","parser","async","parsing"],"dependencies":{"jsonparse":"^1.2.0","through":">=2.2.7 <3"},"devDependencies":{"assertions":"^2.2.2","event-stream":"^0.7.0","it-is":"^1","render":"^0.1.1","tape":"^2.12.3","trees":"^0.0.3"},"bin":{"jsonstream-next":"bin.js"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"node test/run.js"},"optionalDependencies":{},"engines":{"node":"*"},"gitHead":"706ef9073caae48fb1f346d832eb14ac64e71a00","bugs":{"url":"https://github.com/contra/JSONStream/issues"},"_id":"jsonstream-next@1.4.0","_nodeVersion":"10.19.0","_npmVersion":"6.14.2","_npmUser":{"name":"contra","email":"yo@contra.io"},"dist":{"integrity":"sha512-6hYaAUQkHj3GfYC6cQ8yL1sHCBTRHnFKPERe+9h5YeeqaB5uAEetK6bNOQytpPpIeJ0YpPJsI4OZNEbkcPGZhw==","shasum":"d85b0a3bdad86002ad93a920819b2f2a3b293ab9","tarball":"https://registry.npmjs.org/jsonstream-next/-/jsonstream-next-1.4.0.tgz","fileCount":36,"unpackedSize":412435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeY8JeCRA9TVsSAnZWagAA6v4P/RJdijLj35Z/qR5d/aBA\nk5tyyqPSf+STM+JF25+/0ts4VmUtCIA78llcMvGTmnC4h1/gEEqsPI0DwKSz\nnyD3xyNZ9vxKwwH+8Re/1DjOmUZnWWwpIR3tPEH2xjgO8j5dRwbkVbwWfwPX\nrUK8QQCtCTXFxTnYNwwMg8lq/ff6bUIPDEUH/D/KeznKwmVS8941rTyrUeNN\npqsen5Xb15FJam1yc5MreRwdyA7dQu/9f1QCyhEPWNbzR6G0MeuvZ0mErWwD\nG05A9yB6MMXRP9jhqsJcrrft/X9pUdF/48NTXngQoO1CgYWyhZtW9FRDL3MV\niMAG1Gt6RHKgBCEB4Ug6noO/zmmTPEhjGt5H4ROlQtgnA7QnHhbuHQCAhA3v\nqbhEzv36j8N4Iz8XuDUqmKSFZMMxnVrVC4VIHqV4j+haVvzg5E2xsNRRHpwK\nNojt0Z54e5jjhxeZsvdYagZ4IgXNj03wiQyjQDmfdO1F/MDwop1I2A4o4faH\nJ92asMJE378hj+4+NKJyTvB2kBSGjqjGGKg3SY9kqGxoSGV7lJm4i6S33kuL\nfTKH5i4r0SUNkB4FvRE07I36xIZ8+hdeNm93FhPCjSvUjQhsLVl3tdLg7+6b\nUAfKePhyYUhUk5mafpXF2Sk7n3mboslrz3mK+2TN2ZAPVJPvEt9Tg4e8JGUa\nfFw+\r\n=Sctg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCzWGqnsYBxIMVTduDxE/D21TJ7HfBVQ4ZwGsmgARlXQIgc1kj2GCetQ8uYd2knN9tnMKwbcOfOGKOyAc6e3NukmA="}]},"maintainers":[{"name":"contra","email":"yo@contra.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonstream-next_1.4.0_1583596125658_0.06029314163629862"},"_hasShrinkwrap":false},"2.0.0":{"name":"jsonstream-next","version":"2.0.0","description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"http://github.com/contra/JSONStream","repository":{"type":"git","url":"git://github.com/contra/JSONStream.git"},"license":"(MIT OR Apache-2.0)","keywords":["json","stream","streaming","parser","async","parsing"],"dependencies":{"jsonparse":"^1.2.0","through2":"^4.0.2"},"devDependencies":{"assertions":"^2.2.2","event-stream":"^4.0.0","it-is":"^1","render":"^0.1.1","tape":"^5.0.0","trees":"^0.0.4"},"bin":{"jsonstream-next":"bin.js"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"node test/run.js"},"optionalDependencies":{},"engines":{"node":">=10"},"gitHead":"97402692ba51d64d341b4e2b9be6371b6910400b","bugs":{"url":"https://github.com/contra/JSONStream/issues"},"_id":"jsonstream-next@2.0.0","_nodeVersion":"13.14.0","_npmVersion":"6.14.7","_npmUser":{"name":"contra","email":"yo@contra.io"},"dist":{"integrity":"sha512-OAdMRGAwScz8JQLwv6daGcbuddSZnB7aIY8L8/J62xpf5BNtRWqnBM+wBpNSuYgnnwj7SCFxJKp+I9mg3WJrug==","shasum":"71cfe0f827e9b4ff97d09a0ec119096f36ca2895","tarball":"https://registry.npmjs.org/jsonstream-next/-/jsonstream-next-2.0.0.tgz","fileCount":37,"unpackedSize":413290,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfMgUXCRA9TVsSAnZWagAA4M4P/3nerxOH6J2gXppQRQsP\nQQB+qq6hrSwhf67RArxhCbcUKAsN/67C85eYrgpYbJh/cCd3M/ZBKBD5CV2c\n+P0kwSSVyBkpG27tpbwzMjsjdb6PdgVSsOyXs8uIKHtZy05zd3YHjQ4//pfo\nla2I5Q73vBXCrLcWPnbCGXPY4bFg1d9cr8bE3oV1XwWzLZR6MdUcIxaqHDcN\n9Sgvwz+XvWwBopQN1kZESJHQ6NuK1B1+7abc4zkaPmCrFeUieciPLQi4YBsh\nsTr7/Y03rOQe98iKRwIQEqLO4vFJDOoaWniwGp2lnyypO5bJwsPIszQjNdLR\nq2+zJarDeRmks+zHG7PEfuRqhAOcIGvbU1OG+uA903CG5DfjrQzJFSGp8fC1\nkVQk0iBRZoLInL7TEWwt4MfKpBkHVopDyXpC+zIwkKGEuTyhk65Pzhe5zjGv\nvaVMUyyPbhrOZXtVuUD2KhV1cEwdvBZx367L8Hi5+CES04921dS4UUF8fXRi\n5jrQvU4XmDYxsTNjv7uLuoIZfxgALvzAOWJFviXYayOYqKn+Gh2MdGd/rXUh\npStaxGwWL3+RbwPVTtDQMtqY0B2+BzZYAZp968Q1pvGhTqnmTDtwmEv5FRlY\ngAL6kW+wltDTxC+pvCnuNxNuXWtpcYO5ICRaHFwOHghpa6feuBvR7nicV9w2\n9o+F\r\n=9kJO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4ta5jU0xcfLox47bm2UJcH7uGNzGD1UqPh2NNJbmLxwIgUItJUO74Wvmly2OPxrjirabw3VBhf+xgDSruwzQBrmw="}]},"maintainers":[{"name":"contra","email":"yo@contra.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonstream-next_2.0.0_1597113623229_0.6312891215701746"},"_hasShrinkwrap":false},"3.0.0":{"name":"jsonstream-next","version":"3.0.0","description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"http://github.com/contra/JSONStream","repository":{"type":"git","url":"git://github.com/contra/JSONStream.git"},"license":"(MIT OR Apache-2.0)","keywords":["json","stream","streaming","parser","async","parsing"],"dependencies":{"jsonparse":"^1.2.0","through2":"^4.0.2"},"devDependencies":{"assertions":"^2.2.2","event-stream":"^4.0.0","it-is":"^1","render":"^0.1.1","tape":"^5.0.0","trees":"^0.0.4"},"bin":{"jsonstream-next":"bin.js"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"scripts":{"test":"node test/run.js"},"optionalDependencies":{},"engines":{"node":">=10"},"gitHead":"da2341fd6511b20993932a37d94a7abb8f287167","bugs":{"url":"https://github.com/contra/JSONStream/issues"},"_id":"jsonstream-next@3.0.0","_nodeVersion":"13.10.1","_npmVersion":"6.14.4","_npmUser":{"name":"contra","email":"yo@contra.io"},"dist":{"integrity":"sha512-aAi6oPhdt7BKyQn1SrIIGZBt0ukKuOUE1qV6kJ3GgioSOYzsRc8z9Hfr1BVmacA/jLe9nARfmgMGgn68BqIAgg==","shasum":"45664fb89e50799fb220b4e9017cbc458b5917e4","tarball":"https://registry.npmjs.org/jsonstream-next/-/jsonstream-next-3.0.0.tgz","fileCount":37,"unpackedSize":413232,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2wyKCRA9TVsSAnZWagAA1UUP/23WNCIn85XyW9kipxzG\n20daPsJlFGPOXZbIcPmGIzfNgdDnhqX1dmREHnjYDT53qLJ0YFULk1dUEMBp\ncEAN6R18TSCWhiJIndU4BTQrT4n+vJadcdHf+aXZMlxlARpzDWaYjRlshmoa\nlWeIZS3HLVxCGIz6YnVJeq6Qmi0Wga/GdUXORfOR2NXkwxKGUqFt6tXcpd+8\nHe6BHrrOTCn7xUAVnKp6ARQdaaBgfF2PoFV71GkBSFosvxKG7xJUCr+1WDMj\nv0DpRCuWzGo7eSOrMUryFvJ3ujuSu7BhkzJSIb56MSWQaH+mSlXbG4IDqYWU\nOT8sHhWbZ+4cVNaQAJh1JYDHqaDhQSuGRLl2d+9eW5EPd1P+zeGS9lQ1pFRo\nQv6dtcxK3Fl3BmUm7dBIvFGm7WBVMylLISBG1aKw/ZFtvW2ydaO2qR50PxwR\n9vYzzXFtPeqKxdupICot3Z/kz3Bp3NjoZ9c2k7Q7iK4b0U+KnIK+O5NU33g8\no3aatWTmnkmOkDN4EVKHiA0I5nOxmuCa3Cqfq/WpSHBOnrFjX1tW2eN4LSfk\nmhAqlidJTgCK2S7RaX1qOJIzKIXqAcL+nJMtgUxkyN44kUuVqGbw+2aa7syz\nMRP9+5Q4bxs1Zspo8Iy4zEgZgTlCcm6shSqTyrXDXIemplQEXgF1BcbVA2w7\nPWAK\r\n=iysh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsfpdkACd8teZcD2xkeU1xS1HmH8XbULNHvZm8NRpsSgIhAPyI+sfQvPJsdBNw3s+FycHKj9wTUwYmntOW623xlhji"}]},"maintainers":[{"name":"contra","email":"yo@contra.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonstream-next_3.0.0_1597367305859_0.5601213460420504"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-07T15:48:45.658Z","1.4.0":"2020-03-07T15:48:45.863Z","modified":"2022-05-06T23:17:59.102Z","2.0.0":"2020-08-11T02:40:23.465Z","3.0.0":"2020-08-14T01:08:26.031Z"},"maintainers":[{"email":"ericbombhax@gmail.com","name":"yocontra"}],"description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"http://github.com/contra/JSONStream","keywords":["json","stream","streaming","parser","async","parsing"],"repository":{"type":"git","url":"git://github.com/contra/JSONStream.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"bugs":{"url":"https://github.com/contra/JSONStream/issues"},"license":"(MIT OR Apache-2.0)","readme":"# Fork Notes\n\nThis project is a fork of [dominictarr/JSONStream](https://github.com/dominictarr/JSONStream) that:\n\n- Pulls in PRs that fix bugs and makes them all work\n- Adds support for async flush functions\n- Promises to be responsive to future PRs + stay up to date\n- Update to use latest node and streaming patterns\n\nAll thanks and credit goes to the original maintainers!\n\n# JSONStream\n\nstreaming JSON.parse and stringify\n\n![](https://secure.travis-ci.org/contra/JSONStream.png?branch=master)\n\n## install\n```npm install jsonstream-next```\n\n## example\n\n```js\nconst request = require('request')\nconst JSONStream = require('jsonstream-next')\nconst es = require('event-stream')\n\nrequest({ url: 'http://isaacs.couchone.com/registry/_all_docs' })\n  .pipe(JSONStream.parse('rows.*'))\n  .pipe(es.mapSync(function (data) {\n    console.error(data)\n    return data\n  }))\n```\n\n## JSONStream.parse(path)\n\nparse stream of values that match a path\n\n``` js\n  JSONStream.parse('rows.*.doc')\n```\n\nThe `..` operator is the recursive descent operator from [JSONPath](http://goessner.net/articles/JsonPath/), which will match a child at any depth (see examples below).\n\nIf your keys have keys that include `.` or `*` etc, use an array instead.\n`['row', true, /^doc/]`.\n\nIf you use an array, `RegExp`s, booleans, and/or functions. The `..` operator is also available in array representation, using `{recurse: true}`.\nany object that matches the path will be emitted as 'data' (and `pipe`d down stream)\n\nIf `path` is empty or null, no 'data' events are emitted.\n\nIf you want to have keys emitted, you can prefix your `*` operator with `$`: `obj.$*` - in this case the data passed to the stream is an object with a `key` holding the key and a `value` property holding the data.\n\n### Examples\n\nquery a couchdb view:\n\n``` bash\ncurl -sS localhost:5984/tests/_all_docs&include_docs=true\n```\nyou will get something like this:\n\n``` js\n{\"total_rows\":129,\"offset\":0,\"rows\":[\n  { \"id\":\"change1_0.6995461115147918\"\n  , \"key\":\"change1_0.6995461115147918\"\n  , \"value\":{\"rev\":\"1-e240bae28c7bb3667f02760f6398d508\"}\n  , \"doc\":{\n      \"_id\":  \"change1_0.6995461115147918\"\n    , \"_rev\": \"1-e240bae28c7bb3667f02760f6398d508\",\"hello\":1}\n  },\n  { \"id\":\"change2_0.6995461115147918\"\n  , \"key\":\"change2_0.6995461115147918\"\n  , \"value\":{\"rev\":\"1-13677d36b98c0c075145bb8975105153\"}\n  , \"doc\":{\n      \"_id\":\"change2_0.6995461115147918\"\n    , \"_rev\":\"1-13677d36b98c0c075145bb8975105153\"\n    , \"hello\":2\n    }\n  },\n]}\n\n```\n\nwe are probably most interested in the `rows.*.doc`\n\ncreate a `Stream` that parses the documents from the feed like this:\n\n``` js\nvar stream = JSONStream.parse(['rows', true, 'doc']) //rows, ANYTHING, doc\n\nstream.on('data', function(data) {\n  console.log('received:', data);\n});\n//emits anything from _before_ the first match\nstream.on('header', function (data) {\n  console.log('header:', data) // => {\"total_rows\":129,\"offset\":0}\n})\n\n```\nawesome!\n\nIn case you wanted the contents the doc emitted:\n\n``` js\nvar stream = JSONStream.parse(['rows', true, 'doc', {emitKey: true}]) //rows, ANYTHING, doc, items in docs with keys\n\nstream.on('data', function(data) {\n  console.log('key:', data.key);\n  console.log('value:', data.value);\n});\n\n```\n\nYou can also emit the path:\n\n``` js\nvar stream = JSONStream.parse(['rows', true, 'doc', {emitPath: true}]) //rows, ANYTHING, doc, items in docs with keys\n\nstream.on('data', function(data) {\n  console.log('path:', data.path);\n  console.log('value:', data.value);\n});\n\n```\n\n### recursive patterns (..)\n\n`JSONStream.parse('docs..value')`\n(or `JSONStream.parse(['docs', {recurse: true}, 'value'])` using an array)\nwill emit every `value` object that is a child, grand-child, etc. of the\n`docs` object. In this example, it will match exactly 5 times at various depth\nlevels, emitting 0, 1, 2, 3 and 4 as results.\n\n```js\n{\n  \"total\": 5,\n  \"docs\": [\n    {\n      \"key\": {\n        \"value\": 0,\n        \"some\": \"property\"\n      }\n    },\n    {\"value\": 1},\n    {\"value\": 2},\n    {\"blbl\": [{}, {\"a\":0, \"b\":1, \"value\":3}, 10]},\n    {\"value\": 4}\n  ]\n}\n```\n\n## JSONStream.parse(pattern, map)\n\nprovide a function that can be used to map or filter\nthe json output. `map` is passed the value at that node of the pattern,\nif `map` return non-nullish (anything but `null` or `undefined`)\nthat value will be emitted in the stream. If it returns a nullish value,\nnothing will be emitted.\n\n`JSONStream` also emits `'header'` and `'footer'` events,\nthe `'header'` event contains anything in the output that was before\nthe first match, and the `'footer'`, is anything after the last match.\n\n## JSONStream.stringify(open, sep, close)\n\nCreate a writable stream.\n\nyou may pass in custom `open`, `close`, and `seperator` strings.\nBut, by default, `JSONStream.stringify()` will create an array,\n(with default options `open='[\\n', sep='\\n,\\n', close='\\n]\\n'`)\n\nIf you call `JSONStream.stringify(false)`\nthe elements will only be seperated by a newline.\n\nIf you only write one item this will be valid JSON.\n\nIf you write many items,\nyou can use a `RegExp` to split it into valid chunks.\n\n## JSONStream.stringifyObject(open, sep, close)\n\nVery much like `JSONStream.stringify`,\nbut creates a writable stream for objects instead of arrays.\n\nAccordingly, `open='{\\n', sep='\\n,\\n', close='\\n}\\n'`.\n\nWhen you `.write()` to the stream you must supply an array with `[ key, data ]`\nas the first argument.\n\n## unix tool\n\nquery npm to see all the modules that browserify has ever depended on.\n\n``` bash\ncurl https://registry.npmjs.org/browserify | JSONStream 'versions.*.dependencies'\n```\n\n## numbers\n\nnumbers will be emitted as numbers.\nhuge numbers that cannot be represented in memory as javascript numbers will be emitted as strings.\ncf https://github.com/creationix/jsonparse/commit/044b268f01c4b8f97fb936fc85d3bcfba179e5bb for details.\n\n## Acknowlegements\n\nthis module depends on https://github.com/creationix/jsonparse\nby Tim Caswell\nand also thanks to Florent Jaby for teaching me about parsing with:\nhttps://github.com/Floby/node-json-streams\n\n## license\n\nDual-licensed under the MIT License or the Apache License, version 2.0\n","readmeFilename":"README.md"}