{"_id":"@search-dump/jsonstream","_rev":"1-1749ec73e3049c8ec867fd97df1eabc4","name":"@search-dump/jsonstream","dist-tags":{"latest":"1.5.0"},"versions":{"1.4.0":{"name":"@search-dump/jsonstream","version":"1.4.0","description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"https://github.com/elasticsearch-dump/JSONStream","repository":{"type":"git","url":"git://github.com/elasticsearch-dump/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":{"it-is":"~1","assertions":"~2.2.2","render":"~0.1.1","trees":"~0.0.3","event-stream":"~0.7.0","tape":"~2.12.3"},"bin":{"jsonstream":"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":"c187aa7173cf81f69b1f7eea04014fed5f621488","bugs":{"url":"https://github.com/elasticsearch-dump/JSONStream/issues"},"_id":"@search-dump/jsonstream@1.4.0","_nodeVersion":"14.17.6","_npmVersion":"8.1.4","dist":{"integrity":"sha512-E9Dg+F5HwmKVmQtHLXR07422sICI2uN3XPgFZfGcm46sVLNJYDO1bJF549iuOllMZXTCKSaolEaUIekaeb2dHA==","shasum":"3233a7bf17608357a6d45ddbb8788fabb91f8c6a","tarball":"https://registry.npmjs.org/@search-dump/jsonstream/-/jsonstream-1.4.0.tgz","fileCount":6,"unpackedSize":14981,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDblM3DHZ2lB73c4MkfaPMyYVcns0LhSqLx+KzPMQX6zAiBNrA5JvlWJ/5PPKPsvUtZVVZYvyiLZMxAhJbvB6/8TzA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkD6/VACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTGQ/+Lo4rPOOyNhEqrJhje93jk5WbIZnYlt2GCqWM/E6VrqL9lvHU\r\n6Ex1Y8PLntUwyu220aP15HyiAmHTyc/S9vYN7h8nF1d0GTv/60Mc64s5Ht83\r\nez6mdfYtLvJLYN/KASy14sx9FFXodCPxlADqyltAc8S9ZTHuBmjBWauD8E0X\r\nTFbSYQu0rtC1HBR30QoR0DTT9fonvtnV/EP2rIRXD0qJmIl7IxBJWuMwUZq9\r\nYBqWxlGZfjLU8QlNGCWLlulReAcTcvj2OQE/erSrxJXKvSYba3OPF7a94xzx\r\nfzQ6x1CvGnL1eI82YW+4ZYDKE+VTqv57l1aA68WK3JaozlC335US6aGZFWI4\r\n9fFyA0GmJJL+ZE4B7tY6M78xxK+axIKuWbnjRQRJyB8Z4oEcK8Wuf67+hkU4\r\nY3/pvFwzrfEwYb8W4P+sjhOe7RIAQwccre351MGnx8LCOXJsuk7eqWYHsCz3\r\nRwwPhQQF21VQA5HGNY3Gnwex0opDEA2fZ4TG8cSPQdzcZN7nF+ukWhFTNlhz\r\nPluZniHU+wthunv6VTDOPAQV+xGh17kzzDfO1VPbaPTO32oxKt6XTun89qTg\r\nO1P0mmyP9DJY0PDdl0cb6r6J9dhg2GxahDhrMQK/ERlwQPq2h8lD4dx28WAv\r\nkaj6ws71SWGvAOJ+C9sKvuGZOXiqr1VO1QY=\r\n=acST\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ferronrsmith","email":"ferronrsmith@gmail.com"},"directories":{},"maintainers":[{"name":"ferronrsmith","email":"ferronrsmith@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonstream_1.4.0_1678749653019_0.7462319813935339"},"_hasShrinkwrap":false},"1.5.0":{"name":"@search-dump/jsonstream","version":"1.5.0","description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"https://github.com/elasticsearch-dump/JSONStream","repository":{"type":"git","url":"git://github.com/elasticsearch-dump/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":{"it-is":"~1","assertions":"~2.2.2","render":"~0.1.1","trees":"~0.0.3","event-stream":"~0.7.0","tape":"~2.12.3"},"bin":{"jsonstream":"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":"7b0e695b35c983b1af505d95f17f4a49f34f1f45","bugs":{"url":"https://github.com/elasticsearch-dump/JSONStream/issues"},"_id":"@search-dump/jsonstream@1.5.0","_nodeVersion":"14.17.6","_npmVersion":"8.1.4","dist":{"integrity":"sha512-/6JGNTkedAaGCxxWPHLHLzPAv+bJdPK1X4BvdQFfjpUUu8ccwWf5reGRxGf/vPRfly24dspufAwMWkgALW3gbw==","shasum":"28e1102f398ce9eaa25b49308ac5609b23cb9415","tarball":"https://registry.npmjs.org/@search-dump/jsonstream/-/jsonstream-1.5.0.tgz","fileCount":6,"unpackedSize":14994,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMVUjQ5t2Tnr0xdE3ep9mpRwTaS0W34u+rw2/4w5iweAIhAKDBH8eewpvbBfczNm1jqVnTlCHSDfI8Y74M127Nr9RK"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEX5OACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopVw/+MOGvmkBnimWASzszcC0LpDKUfY7FiJMJ/1MVqwFuSQv0F+ga\r\n8JieiFrGHeTJ6GSuCDHx4V0IlZDlc2NC2rvMlN6J8uR2xnBHYlFF4Um11ucD\r\nTiM3NQsVI3e9kydPonGGxkMOQCLtJNEbFrDz4ZScEpeV1vcYxfoxzZGjzNc3\r\nbJ2V7zTYBPjSyD08Hk9SbomzVy9FUCxL8BAkTyHW64RZjN6ZekJZPIjjNMme\r\ne3VVstzAVvSxO/iXNMKrXKw2ilIaa6aFLA/Bc+i4ZxUPR8sp7EF/gXMyXLSJ\r\n6jk4+jsns9NRFtG0VD+FwBFVxBr7alPqabLqTTMkzHi/sskB8xKrDKrRj8EZ\r\naLv418IkWV9U/kq4Wjfoc3mg3KzRAv6P3iPUHXFUDgXsk31+tWQ2Yr6KzFdU\r\nUZ5Vn7LxC7P7YLlp1CYNF9Lro5E9S5XjpF7QqKww4KcfC7jWHoO3nTJoAM7E\r\n0HPySjh80q/y7AR9jn0Xtgh99QT9ja2gusBIm2evrqyf2cBuxXxX3jZ0c/cf\r\n1SOYcbx1bkV7h9Sov7IEe4H+Ep7ZIrmwJXgWo9j9Kq4pvpnDuznZXqLUph2c\r\nCRzP3EkPPE8NHP5RoDk61wB6HYC8uWtAuFIkBdeGNKux+HaeBwkwL4g+AQdl\r\n+rvGqLDURK1ol59y1m1vqsBEy4rwziOC+3Y=\r\n=az3f\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"ferronrsmith","email":"ferronrsmith@gmail.com"},"directories":{},"maintainers":[{"name":"ferronrsmith","email":"ferronrsmith@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jsonstream_1.5.0_1678868046554_0.4403115013607475"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-13T23:20:52.959Z","1.4.0":"2023-03-13T23:20:53.200Z","modified":"2023-03-15T08:14:06.911Z","1.5.0":"2023-03-15T08:14:06.752Z"},"maintainers":[{"name":"ferronrsmith","email":"ferronrsmith@gmail.com"}],"description":"rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)","homepage":"https://github.com/elasticsearch-dump/JSONStream","keywords":["json","stream","streaming","parser","async","parsing"],"repository":{"type":"git","url":"git://github.com/elasticsearch-dump/JSONStream.git"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com","url":"http://bit.ly/dominictarr"},"bugs":{"url":"https://github.com/elasticsearch-dump/JSONStream/issues"},"license":"(MIT OR Apache-2.0)","readme":"# jsonstream\n\nstreaming JSON.parse and stringify\n\n## install\n```npm install @search-dump/jsonstream```\n\n## example\n\n```js\nvar request = require('request')\n  , JSONStream = require('@search-dump/jsonstream')\n  , 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```json\n{\n  \"total_rows\": 129,\n  \"offset\": 0,\n  \"rows\": [\n    {\n      \"id\": \"change1_0.6995461115147918\",\n      \"key\": \"change1_0.6995461115147918\",\n      \"value\": {\n        \"rev\": \"1-e240bae28c7bb3667f02760f6398d508\"\n      },\n      \"doc\": {\n        \"_id\": \"change1_0.6995461115147918\",\n        \"_rev\": \"1-e240bae28c7bb3667f02760f6398d508\",\n        \"hello\": 1\n      }\n    },\n    {\n      \"id\": \"change2_0.6995461115147918\",\n      \"key\": \"change2_0.6995461115147918\",\n      \"value\": {\n        \"rev\": \"1-13677d36b98c0c075145bb8975105153\"\n      },\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```json\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## Acknowledgements\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\n","readmeFilename":"readme.markdown"}