{
	"name": "peek-stream",
	"versions": {
		"1.0.0": {
			"name": "peek-stream",
			"version": "1.0.0",
			"description": "Transform stream that lets you peek the first line before deciding how to parse it",
			"main": "index.js",
			"dependencies": {
				"duplexify": "^3.0.0",
				"through2": "^0.5.1"
			},
			"devDependencies": {
				"concat-stream": "^1.4.6",
				"tape": "^2.13.4"
			},
			"scripts": {
				"test": "tape test.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mafintosh/peek-stream"
			},
			"keywords": [
				"peek",
				"stream",
				"parse",
				"swap"
			],
			"author": {
				"name": "Mathias Buus"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mafintosh/peek-stream/issues"
			},
			"homepage": "https://github.com/mafintosh/peek-stream",
			"gitHead": "13f3b52cf59063ce63bd2502c5a6027a6ed295e9",
			"_id": "peek-stream@1.0.0",
			"_shasum": "cdfea6d156dec38bac396e0e86561f17ca38b5f6",
			"_from": ".",
			"_npmVersion": "1.4.14",
			"_npmUser": {
				"name": "mafintosh",
				"email": "mathiasbuus@gmail.com"
			},
			"maintainers": [
				{
					"name": "mafintosh",
					"email": "mathiasbuus@gmail.com"
				}
			],
			"dist": {
				"shasum": "cdfea6d156dec38bac396e0e86561f17ca38b5f6",
				"tarball": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.0.0.tgz"
			},
			"directories": {},
			"contributors": []
		},
		"1.1.0": {
			"name": "peek-stream",
			"version": "1.1.0",
			"description": "Transform stream that lets you peek the first line before deciding how to parse it",
			"main": "index.js",
			"dependencies": {
				"duplexify": "^3.0.0",
				"through2": "^0.5.1"
			},
			"devDependencies": {
				"concat-stream": "^1.4.6",
				"tape": "^2.13.4"
			},
			"scripts": {
				"test": "tape test.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mafintosh/peek-stream"
			},
			"keywords": [
				"peek",
				"stream",
				"parse",
				"swap"
			],
			"author": {
				"name": "Mathias Buus"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mafintosh/peek-stream/issues"
			},
			"homepage": "https://github.com/mafintosh/peek-stream",
			"gitHead": "abeb3591cbb943d79bf610de8ec6d5a61d268d7f",
			"_id": "peek-stream@1.1.0",
			"_shasum": "3a84321e40cf0530769928e4c5b4eb90f1784208",
			"_from": ".",
			"_npmVersion": "1.4.14",
			"_npmUser": {
				"name": "mafintosh",
				"email": "mathiasbuus@gmail.com"
			},
			"maintainers": [
				{
					"name": "mafintosh",
					"email": "mathiasbuus@gmail.com"
				}
			],
			"dist": {
				"shasum": "3a84321e40cf0530769928e4c5b4eb90f1784208",
				"tarball": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.0.tgz"
			},
			"directories": {},
			"contributors": []
		},
		"1.1.1": {
			"name": "peek-stream",
			"version": "1.1.1",
			"description": "Transform stream that lets you peek the first line before deciding how to parse it",
			"main": "index.js",
			"dependencies": {
				"duplexify": "^3.0.1",
				"through2": "^0.5.1"
			},
			"devDependencies": {
				"concat-stream": "^1.4.6",
				"tape": "^2.13.4"
			},
			"scripts": {
				"test": "tape test.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mafintosh/peek-stream"
			},
			"keywords": [
				"peek",
				"stream",
				"parse",
				"swap"
			],
			"author": {
				"name": "Mathias Buus"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mafintosh/peek-stream/issues"
			},
			"homepage": "https://github.com/mafintosh/peek-stream",
			"gitHead": "2496fd5f39c06ef3c53426c7b24ce63f01cfc831",
			"_id": "peek-stream@1.1.1",
			"_shasum": "5324259966a9c97ce2f0470f67c23bf248f8e7f0",
			"_from": ".",
			"_npmVersion": "1.4.21",
			"_npmUser": {
				"name": "mafintosh",
				"email": "mathiasbuus@gmail.com"
			},
			"maintainers": [
				{
					"name": "mafintosh",
					"email": "mathiasbuus@gmail.com"
				}
			],
			"dist": {
				"shasum": "5324259966a9c97ce2f0470f67c23bf248f8e7f0",
				"tarball": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.1.tgz"
			},
			"directories": {},
			"contributors": []
		},
		"1.1.2": {
			"name": "peek-stream",
			"version": "1.1.2",
			"description": "Transform stream that lets you peek the first line before deciding how to parse it",
			"main": "index.js",
			"dependencies": {
				"duplexify": "^3.5.0",
				"through2": "^2.0.3"
			},
			"devDependencies": {
				"concat-stream": "^1.6.0",
				"tape": "^4.6.3"
			},
			"scripts": {
				"test": "tape test.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mafintosh/peek-stream.git"
			},
			"keywords": [
				"peek",
				"stream",
				"parse",
				"swap"
			],
			"author": {
				"name": "Mathias Buus"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mafintosh/peek-stream/issues"
			},
			"homepage": "https://github.com/mafintosh/peek-stream",
			"gitHead": "c444747273f0f9b55aea3f38f36ea1540c3e3673",
			"_id": "peek-stream@1.1.2",
			"_shasum": "97eb76365bcfd8c89e287f55c8b69d4c3e9bcc52",
			"_from": ".",
			"_npmVersion": "3.10.10",
			"_nodeVersion": "6.9.5",
			"_npmUser": {
				"name": "mafintosh",
				"email": "mathiasbuus@gmail.com"
			},
			"dist": {
				"shasum": "97eb76365bcfd8c89e287f55c8b69d4c3e9bcc52",
				"tarball": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.2.tgz"
			},
			"maintainers": [
				{
					"name": "mafintosh",
					"email": "mathiasbuus@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "packages-12-west.internal.npmjs.com",
				"tmp": "tmp/peek-stream-1.1.2.tgz_1491653057530_0.8997211237438023"
			},
			"directories": {},
			"contributors": []
		},
		"1.1.3": {
			"name": "peek-stream",
			"version": "1.1.3",
			"description": "Transform stream that lets you peek the first line before deciding how to parse it",
			"main": "index.js",
			"dependencies": {
				"buffer-from": "^1.0.0",
				"duplexify": "^3.5.0",
				"through2": "^2.0.3"
			},
			"devDependencies": {
				"concat-stream": "^1.6.0",
				"tape": "^4.6.3"
			},
			"scripts": {
				"test": "tape test.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mafintosh/peek-stream.git"
			},
			"keywords": [
				"peek",
				"stream",
				"parse",
				"swap"
			],
			"author": {
				"name": "Mathias Buus"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mafintosh/peek-stream/issues"
			},
			"homepage": "https://github.com/mafintosh/peek-stream",
			"gitHead": "93ee7f3ef52de411293be0e6b37edcd541b9d756",
			"_id": "peek-stream@1.1.3",
			"_npmVersion": "5.6.0",
			"_nodeVersion": "9.7.1",
			"_npmUser": {
				"name": "mafintosh",
				"email": "mathiasbuus@gmail.com"
			},
			"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
			},
			"maintainers": [
				{
					"name": "mafintosh",
					"email": "mathiasbuus@gmail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/peek-stream_1.1.3_1521673907391_0.47990638016893583"
			},
			"contributors": []
		}
	},
	"time": {
		"modified": "2018-03-21T23:11:48.259Z",
		"created": "2014-07-23T15:19:14.308Z",
		"1.0.0": "2014-07-23T15:19:14.308Z",
		"1.1.0": "2014-07-23T15:56:35.802Z",
		"1.1.1": "2014-07-25T19:10:18.389Z",
		"1.1.2": "2017-04-08T12:04:19.459Z",
		"1.1.3": "2018-03-21T23:11:47.457Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "1.1.3"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"1331d545c5ecda5f0915ead91db4f932\"",
			"fetched": 1602009412168
		}
	},
	"_distfiles": {
		"peek-stream-1.0.0.tgz": {
			"url": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.0.0.tgz",
			"sha": "cdfea6d156dec38bac396e0e86561f17ca38b5f6",
			"registry": "npmjs"
		},
		"peek-stream-1.1.0.tgz": {
			"url": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.0.tgz",
			"sha": "3a84321e40cf0530769928e4c5b4eb90f1784208",
			"registry": "npmjs"
		},
		"peek-stream-1.1.1.tgz": {
			"url": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.1.tgz",
			"sha": "5324259966a9c97ce2f0470f67c23bf248f8e7f0",
			"registry": "npmjs"
		},
		"peek-stream-1.1.2.tgz": {
			"url": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.2.tgz",
			"sha": "97eb76365bcfd8c89e287f55c8b69d4c3e9bcc52",
			"registry": "npmjs"
		},
		"peek-stream-1.1.3.tgz": {
			"url": "https://registry.npmjs.org/peek-stream/-/peek-stream-1.1.3.tgz",
			"sha": "3b35d84b7ccbbd262fff31dc10da56856ead6d67",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"peek-stream-1.1.3.tgz": {
			"shasum": "3b35d84b7ccbbd262fff31dc10da56856ead6d67"
		}
	},
	"_rev": "13-d6f540d0403158d2",
	"_id": "peek-stream",
	"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"
}