{
  "_args": [
    [
      {
        "raw": "peek-stream@^1.1.1",
        "scope": null,
        "escapedName": "peek-stream",
        "name": "peek-stream",
        "rawSpec": "^1.1.1",
        "spec": ">=1.1.1 <2.0.0",
        "type": "range"
      },
      "/home/zkochan/src/pnpm/packages/pnpm/node_modules/bzip2-maybe"
    ]
  ],
  "_from": "peek-stream@>=1.1.1 <2.0.0",
  "_id": "peek-stream@1.1.3",
  "_inCache": true,
  "_location": "/peek-stream",
  "_nodeVersion": "9.7.1",
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/peek-stream_1.1.3_1521673907391_0.47990638016893583"
  },
  "_npmUser": {
    "name": "mafintosh",
    "email": "mathiasbuus@gmail.com"
  },
  "_npmVersion": "5.6.0",
  "_phantomChildren": {},
  "_requested": {
    "raw": "peek-stream@^1.1.1",
    "scope": null,
    "escapedName": "peek-stream",
    "name": "peek-stream",
    "rawSpec": "^1.1.1",
    "spec": ">=1.1.1 <2.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/bzip2-maybe",
    "/gunzip-maybe"
  ],
  "_resolved": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz",
  "_shasum": "3b35d84b7ccbbd262fff31dc10da56856ead6d67",
  "_shrinkwrap": null,
  "_spec": "peek-stream@^1.1.1",
  "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/bzip2-maybe",
  "author": {
    "name": "Mathias Buus"
  },
  "bugs": {
    "url": "https://github.com/mafintosh/peek-stream/issues"
  },
  "dependencies": {
    "buffer-from": "^1.0.0",
    "duplexify": "^3.5.0",
    "through2": "^2.0.3"
  },
  "description": "Transform stream that lets you peek the first line before deciding how to parse it",
  "devDependencies": {
    "concat-stream": "^1.6.0",
    "tape": "^4.6.3"
  },
  "directories": {},
  "dist": {
    "integrity": "sha512-FhJ+YbOSBb9/rIl2ZeE/QHEsWn7PqNYt8ARAY3kIgNGOk13g9FGyIY6JIl/xB/3TFRVoTv5as0l11weORrTekA==",
    "shasum": "3b35d84b7ccbbd262fff31dc10da56856ead6d67",
    "tarball": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz",
    "fileCount": 7,
    "unpackedSize": 8156
  },
  "gitHead": "93ee7f3ef52de411293be0e6b37edcd541b9d756",
  "homepage": "https://github.com/mafintosh/peek-stream",
  "keywords": [
    "peek",
    "stream",
    "parse",
    "swap"
  ],
  "license": "MIT",
  "main": "index.js",
  "maintainers": [
    {
      "name": "mafintosh",
      "email": "mathiasbuus@gmail.com"
    }
  ],
  "name": "peek-stream",
  "optionalDependencies": {},
  "readme": "# peek-stream\n\nTransform stream that lets you peek the first line before deciding how to parse it\n\n```\nnpm install peek-stream\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/peek-stream.svg?style=flat)](http://travis-ci.org/mafintosh/peek-stream)\n![dat](http://img.shields.io/badge/Development%20sponsored%20by-dat-green.svg?style=flat)\n\n## Usage\n\n``` js\nvar peek = require('peek-stream')\nvar ldjson = require('ldjson-stream')\nvar csv = require('csv-parser')\n\nvar isCSV = function(data) {\n  return data.toString().indexOf(',') > -1\n}\n\nvar isJSON = function(data) {\n  try {\n    JSON.parse(data)\n    return true\n  } catch (err) {\n    return false\n  }\n}\n\n// call parser to create a new parser\nvar parser = function() {\n  return peek(function(data, swap) {\n    // maybe it is JSON?\n    if (isJSON(data)) return swap(null, ldjson())\n\n    // maybe it is CSV?\n    if (isCSV(data)) return swap(null, csv())\n\n    // we do not know - bail\n    swap(new Error('No parser available'))\n  })\n}\n```\n\nThe above parser will be able to parse both line delimited JSON and CSV\n\n``` js\nvar parse = parser()\n\nparse.write('{\"hello\":\"world\"}\\n{\"hello\":\"another\"}\\n')\nparse.on('data', function(data) {\n  console.log(data) // prints {hello:'world'} and {hello:'another'}\n})\n```\n\nOr\n\n``` js\nvar parse = parser()\n\nparse.write('test,header\\nvalue-1,value-2\\n')\nparse.on('data', function(data) {\n  console.log(data) // prints {test:'value-1', header:'value-2'}\n})\n```\n\nPer default `data` is the first line (or the first `65535` bytes if no newline is found).\nTo change the max buffer pass an options map to the constructor\n\n``` js\nvar parse = peek({\n  maxBuffer: 10000\n}, function(data, swap) {\n  ...\n})\n```\n\nIf you want to emit an error if no newline is found set `strict: true` as well.\n\n\n## License\n\nMIT",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/mafintosh/peek-stream.git"
  },
  "scripts": {
    "test": "tape test.js"
  },
  "version": "1.1.3"
}
