{
  "_id": "minipass-json-stream",
  "maintainers": [
    {
      "name": "isaacs",
      "email": "i@izs.me"
    }
  ],
  "keywords": [
    "stream",
    "json",
    "parse",
    "minipass",
    "JSONStream"
  ],
  "dist-tags": {
    "latest": "1.0.2"
  },
  "author": {
    "name": "Isaac Z. Schlueter",
    "email": "i@izs.me",
    "url": "https://izs.me"
  },
  "_rev": "3-e375d63ccdffeda9cd486a741d2b05a0",
  "description": "Like JSONStream, but using Minipass streams",
  "readme": "# minipass-json-stream\n\nLike [JSONStream](http://npm.im/JSONStream), but using Minipass streams\n\n## install\n\n```\nnpm install minipass-json-stream\n```\n\n## example\n\n```js\n\nconst request = require('request')\nconst JSONStream = require('minipass-json-stream')\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## new JSONStream(options)\n\nCreate a new stream.  This is a [minipass](http://npm.im/minipass) stream\nthat is always set in `objectMode`.  It emits objects parsed out of\nstring/buffer JSON input that match the supplied `path` option.\n\n## JSONStream.parse(path)\n\nReturn a new JSONStream object to stream values that match a path.\n\n(Equivalent to `new JSONStream({path})`.)\n\n``` js\nJSONStream.parse('rows.*.doc')\n```\n\nThe `..` operator is the recursive descent operator from\n[JSONPath](http://goessner.net/articles/JsonPath/), which will match a\nchild 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 `..`\noperator is also available in array representation, using `{recurse:\ntrue}`.  any object that matches the path will be emitted as 'data' (and\n`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\n`$`: `obj.$*` - in this case the data passed to the stream is an object\nwith 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\nwe are probably most interested in the `rows.*.doc`\n\ncreate a `JSONStream` 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\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\n// equivalent to: 'rows.*.doc.$*'\nvar stream = JSONStream.parse([\n  'rows',\n  true,\n  'doc',\n  {emitKey: true}\n]) //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\nYou can also emit the path:\n\n``` js\nvar stream = JSONStream.parse([\n  'rows',\n  true,\n  'doc',\n  {emitPath: true}\n]) //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### 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\n(Equivalent to `new JSONStream({ 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## Acknowlegements\n\nThis module is a fork of [JSONStream](http://npm.im/JSONStream) by Dominic\nTarr, modified and redistributed under the terms of the MIT license.\n\nthis module depends on https://github.com/creationix/jsonparse\nby Tim Caswell\n",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/isaacs/minipass-json-stream.git"
  },
  "bugs": {
    "url": "https://github.com/isaacs/minipass-json-stream/issues"
  },
  "license": "MIT",
  "versions": {
    "1.0.0": {
      "name": "minipass-json-stream",
      "version": "1.0.0",
      "keywords": [
        "stream",
        "json",
        "parse",
        "minipass",
        "JSONStream"
      ],
      "author": {
        "url": "https://izs.me",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "MIT",
      "_id": "minipass-json-stream@1.0.0",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/npm/minipass-json-stream#readme",
      "bugs": {
        "url": "https://github.com/npm/minipass-json-stream/issues"
      },
      "tap": {
        "check-coverage": true
      },
      "dist": {
        "shasum": "0d74117b7133336ddedf784646636c11ae365e13",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/minipass-json-stream/-/minipass-json-stream-1.0.0.tgz",
        "fileCount": 16,
        "integrity": "sha512-AaIXVqo4BrHWSg1a8neqE7/pxMeEoK5QS1VB02xzQHL/ChfQnbsRHRmdvabmwbchO+NJPzBHB1GdB43+0Kr3vw==",
        "signatures": [
          {
            "sig": "MEUCIQDK96WZiLjinzf0MCrxV+3xbb5AGy5ka67CVbBPg4vF5wIgc0XP34CcUi9xZzcJH3S7P3Nu3dQbbZ4yqRSPrYGu/Cs=",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 146782,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdk6N3CRA9TVsSAnZWagAA794P/2G4Pdioue9QhVJPLSxU\nqe16V7Bv6NVaNETfVtitJxH2j5hJsQclipDs27ukg7NYvd8KEL5zqbql+1Rs\nyLpccDS4zC15jPuuFjIvqyQZEqOm0GwSr3g0apK/KnDKS0PxkrSVHs0vbLDr\nHXeNVLCfwbGkJzjdsO9NJ//25kssUWCLY+1HX3YOLq8h6K0cE6bzIlgSYCYk\ncUBH0Pa7G23aY5uv9KjzoO+jfcBHnVA2CR2xb/UYkWPTg07a7/ztv9oI6Rjl\nfYInBiHUBHWawldqil3vPC6gxoj/igzD+YvoYkIBT1WIIwc3qS6GyaLz1Zja\nEZnaazDucmOe3Sc1V7j7bkzbmo94kiBidGB+ZHiVwwSJmFmM4WKJ8XWo7Fq6\nY1EZ2Xl9nDRFd0iNfWjlQVQiMJnNZTYLnvOkcRhvNh7GuXAJRTpkSIwjJWj/\nS1XvZ/pGVKLOjjm2rXgYhEAIKxHvN5jSkc4TrsFi9wuL/H6msvVeUkC67sil\npm0xl3gDclBIF9pSjrNjHBtE/PaB8ScLLZrK/aabrPiSkGN28C9ZoS7SFCq6\nIwZU4dRVOfxjXEfynAJmOy12Olt6wsctyQUr3i+QmzEO2vtNqmFWiNDV1nRB\nv1bRWbo2D4321/QTcBM8iVWdNOgfHKh6WqlZRoPBOBxJAzIPeMDz5aH9vwvE\n0iAN\r\n=j3EU\r\n-----END PGP SIGNATURE-----\r\n"
      },
      "gitHead": "7cf670ea29c50db66c62a803231d5dd6c7674e0c",
      "scripts": {
        "snap": "tap",
        "test": "tap",
        "preversion": "npm test",
        "postpublish": "git push origin --follow-tags",
        "postversion": "npm publish"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git+https://github.com/npm/minipass-json-stream.git",
        "type": "git"
      },
      "_npmVersion": "6.12.0-next.0",
      "description": "Like JSONStream, but using Minipass streams",
      "directories": {},
      "_nodeVersion": "12.8.1",
      "dependencies": {
        "minipass": "^3.0.0",
        "jsonparse": "^1.3.1"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "tap": "^14.6.9",
        "JSONStream": "^1.3.5"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/minipass-json-stream_1.0.0_1569956727149_0.943201609487669",
        "host": "s3://npm-registry-packages"
      }
    },
    "1.0.1": {
      "name": "minipass-json-stream",
      "version": "1.0.1",
      "keywords": [
        "stream",
        "json",
        "parse",
        "minipass",
        "JSONStream"
      ],
      "author": {
        "url": "https://izs.me",
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me"
      },
      "license": "MIT",
      "_id": "minipass-json-stream@1.0.1",
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "homepage": "https://github.com/npm/minipass-json-stream#readme",
      "bugs": {
        "url": "https://github.com/npm/minipass-json-stream/issues"
      },
      "tap": {
        "check-coverage": true
      },
      "dist": {
        "shasum": "7edbb92588fbfc2ff1db2fc10397acb7b6b44aa7",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/minipass-json-stream/-/minipass-json-stream-1.0.1.tgz",
        "fileCount": 4,
        "integrity": "sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==",
        "signatures": [
          {
            "sig": "MEYCIQDAeaoWlNa5P38QpZA3PJBGsZoZF/9d99kJfhK40+S7ZQIhAMMta/BuQm2DNJ8Vxrp2cLhMpJKPuc741p8Uu2nrZQLZ",
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
          }
        ],
        "unpackedSize": 13013,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdk6OtCRA9TVsSAnZWagAAhfcQAJSXvKVnNuQz2ulGNgsZ\niUDMqNOktkBnu0Ywd+fc3J1DD5Q62bg05utyAdt07pdPVmSKdVfyaxYIk2yS\nm7bxbdk1OueONpLFJMtgEoCtinnFRrEtjAyPP0pIKh3gTpJiZbjgP91+fpqo\nxz7mLfHn4V3eZGsMzaChKBEequKbEXnc4VvX/2oMExgzu/mWC/TqErNKYF/w\nHRd4ehuzVrAL2CBXkHMJL5TRyhq5ANnFOKfWCxU9rNgaApYmcPYetfyEwIKE\nk44SfNPCFfbYB+xjF9Rm4lQCIzF5x3rlHfMPqXQ8SIPbBf4ESgtV1deD6p4Q\np3e2THuWXf0KIxBbJN0tkQWefDrNtG0Acbzl29YmmAZOm5XAu1EkCukplAw5\nljJJyXFHJ1tp/Fi7HxqU2/sGMqFxjEEbq74NV5ipBY4+yfDPwpgo6SuQXCEX\n0wPdUobffLND9ynRCsBWkjToRmXcfzopV2gAc7fdcLwiBajh1FHQzm9DHvjf\n0lmXbTEwgDoH+IJA4SlylnM0n/DiapBqPpeLmfIgGRaFMuouxVaMuSpL+ouZ\nvBHt9kdUqH5YARI75yshspTnlvhX3aKsFSzv+y7st9MjYFvEA+Nz+m/StlNo\nBfQRKkEP+2CP00hyPYhjaUFys60AbXlqZM4TQ2AUVT5dfD1Mlng3lDWpDihq\nNNYb\r\n=4czE\r\n-----END PGP SIGNATURE-----\r\n"
      },
      "gitHead": "38826f1f7ccc32023afc603c218fb6f2a15b407e",
      "scripts": {
        "snap": "tap",
        "test": "tap",
        "preversion": "npm test",
        "postpublish": "git push origin --follow-tags",
        "postversion": "npm publish"
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "repository": {
        "url": "git+https://github.com/npm/minipass-json-stream.git",
        "type": "git"
      },
      "_npmVersion": "6.12.0-next.0",
      "description": "Like JSONStream, but using Minipass streams",
      "directories": {},
      "_nodeVersion": "12.8.1",
      "dependencies": {
        "minipass": "^3.0.0",
        "jsonparse": "^1.3.1"
      },
      "_hasShrinkwrap": false,
      "devDependencies": {
        "tap": "^14.6.9",
        "JSONStream": "^1.3.5"
      },
      "_npmOperationalInternal": {
        "tmp": "tmp/minipass-json-stream_1.0.1_1569956780798_0.737651803293434",
        "host": "s3://npm-registry-packages"
      }
    },
    "1.0.2": {
      "name": "minipass-json-stream",
      "version": "1.0.2",
      "description": "Like JSONStream, but using Minipass streams",
      "author": {
        "name": "Isaac Z. Schlueter",
        "email": "i@izs.me",
        "url": "https://izs.me"
      },
      "license": "MIT",
      "scripts": {
        "test": "tap",
        "snap": "tap",
        "preversion": "npm test",
        "postversion": "npm publish",
        "postpublish": "git push origin --follow-tags"
      },
      "devDependencies": {
        "JSONStream": "^1.3.5",
        "tap": "^14.6.9"
      },
      "dependencies": {
        "jsonparse": "^1.3.1",
        "minipass": "^3.0.0"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/isaacs/minipass-json-stream.git"
      },
      "keywords": [
        "stream",
        "json",
        "parse",
        "minipass",
        "JSONStream"
      ],
      "gitHead": "ae8c7ceb2a222467678f868dddfa55c39f0a5d81",
      "bugs": {
        "url": "https://github.com/isaacs/minipass-json-stream/issues"
      },
      "homepage": "https://github.com/isaacs/minipass-json-stream#readme",
      "_id": "minipass-json-stream@1.0.2",
      "_nodeVersion": "14.21.3",
      "_npmVersion": "6.14.18",
      "dist": {
        "integrity": "sha512-myxeeTm57lYs8pH2nxPzmEEg8DGIgW+9mv6D4JZD2pa81I/OBjeU7PtICXV6c9eRGTA5JMDsuIPUZRCyBMYNhg==",
        "shasum": "5121616c77a11c406c3ffa77509e0b77bb267ec3",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/minipass-json-stream/-/minipass-json-stream-1.0.2.tgz",
        "fileCount": 4,
        "unpackedSize": 14445,
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIE0OH3zOrfk+FJ4qvWBPfhXK9+LD3hX2gqb3QQUfZWjsAiB96vhneZ+dzkjkPl/JRDggUUt7KBdVfansgEKZ0PeHAg=="
          }
        ]
      },
      "_npmUser": {
        "name": "isaacs",
        "email": "i@izs.me"
      },
      "directories": {},
      "maintainers": [
        {
          "name": "isaacs",
          "email": "i@izs.me"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/minipass-json-stream_1.0.2_1722204758103_0.029703413644074805"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "minipass-json-stream",
  "time": {
    "created": "2019-10-01T19:05:27.149Z",
    "modified": "2026-05-13T13:50:53.845Z",
    "1.0.0": "2019-10-01T19:05:27.280Z",
    "1.0.1": "2019-10-01T19:06:20.951Z",
    "1.0.2": "2024-07-28T22:12:38.262Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/isaacs/minipass-json-stream#readme"
}