{
  "_args": [
    [
      {
        "raw": "split-array-stream@https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
        "scope": null,
        "escapedName": "split-array-stream",
        "name": "split-array-stream",
        "rawSpec": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
        "spec": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
        "type": "remote"
      },
      "E:\\MissionXJC\\XJC\\functions\\node_modules\\firebase-admin"
    ]
  ],
  "_from": "split-array-stream@>=1.0.0 <2.0.0",
  "_id": "split-array-stream@1.0.3",
  "_inCache": true,
  "_location": "/firebase-admin/split-array-stream",
  "_phantomChildren": {},
  "_requested": {
    "raw": "split-array-stream@https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
    "scope": null,
    "escapedName": "split-array-stream",
    "name": "split-array-stream",
    "rawSpec": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
    "spec": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/firebase-admin",
    "/firebase-admin/@google-cloud/common"
  ],
  "_resolved": "https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
  "_shasum": "d2b75a8e5e0d824d52fdec8b8225839dc2e35dfa",
  "_shrinkwrap": null,
  "_spec": "split-array-stream@https://registry.npmjs.org/split-array-stream/-/split-array-stream-1.0.3.tgz",
  "_where": "E:\\MissionXJC\\XJC\\functions\\node_modules\\firebase-admin",
  "author": {
    "name": "Stephen Sawchuk",
    "email": "sawchuk@gmail.com"
  },
  "bugs": {
    "url": "https://github.com/stephenplusplus/split-array-stream/issues"
  },
  "dependencies": {
    "async": "^2.4.0",
    "is-stream-ended": "^0.1.0"
  },
  "description": "Safely push each item of an array to a stream",
  "devDependencies": {
    "mocha": "^3.3.0",
    "through2": "^2.0.0"
  },
  "homepage": "https://github.com/stephenplusplus/split-array-stream#readme",
  "keywords": [
    "array",
    "stream",
    "split",
    "push"
  ],
  "license": "MIT",
  "main": "index.js",
  "name": "split-array-stream",
  "optionalDependencies": {},
  "readme": "# split-array-stream\n> Safely push each item of an array to a stream.\n\n```sh\n$ npm install --save split-array-stream\n```\n```js\nvar split = require('split-array-stream');\nvar through = require('through2');\n\nvar array = [\n  { id: 1, user: 'Dave' },\n  { id: 2, user: 'Stephen' }\n];\n\nvar stream = through.obj();\n\nstream.on('data', function (item) {\n  // { id: 1, user: 'Dave' }\n  // ...later...\n  // { id: 2, user: 'Stephen' }\n});\n\nsplit(array, stream, function (streamEnded) {\n  if (!streamEnded) {\n    stream.push(null);\n    stream.end();\n  }\n});\n```\n\nBefore pushing an item to the stream, `split-array-stream` checks that the stream hasn't been ended. This avoids those \"push() after EOF\" errors.\n\n### Use case\n\nSay you're getting many items from an upstream API. Multiple requests might be required to page through all of the results. You want to push the results to the stream as they come in, and only get more results if the user hasn't ended the stream.\n\n```js\nfunction getAllUsers() {\n  var stream = through.obj();\n\n  var requestOptions = {\n    method: 'get',\n    url: 'http://api/users',\n  };\n\n  request(requestOptions, onResponse);\n\n  function onResponse(err, response) {\n    split(response.users, stream, function (streamEnded) {\n      if (streamEnded) {\n        return;\n      }\n\n      if (response.nextPageToken) {\n        requestOptions.pageToken = response.nextPageToken;\n        request(requestOptions, onResponse);\n        return;\n      }\n\n      stream.push(null);\n      stream.end();\n    });\n\n  });\n\n  return stream;\n}\n\ngetAllUsers()\n  .on('data', function (user) {\n    // An item from the `response.users` API response\n  })\n  .on('end', function () {\n    // All users received\n  });\n```\n\n\n### split(array, stream, callback)\n\n#### array\n\n- Type: `Array`\n- Required\n\nThe source array. Each item will be pushed to the provided stream.\n\n#### stream\n\n- Type: `Stream`\n- Required\n\nThe destination stream to receive the items of the array.\n\n#### callback(streamEnded)\n\n- Type: `Function`\n- Required\n\nCallback function executed after all items of the array have been iterated.\n\n##### callback.streamEnded\n\n- Type: `Boolean`\n\nLets you know if the stream has been ended while items were being pushed.\n",
  "readmeFilename": "readme.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/stephenplusplus/split-array-stream.git"
  },
  "scripts": {
    "test": "mocha"
  },
  "version": "1.0.3"
}
