{
	"name": "first-chunk-stream",
	"versions": {
		"0.1.0": {
			"name": "first-chunk-stream",
			"version": "0.1.0",
			"description": "Transform the first chunk in a stream",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git://github.com/sindresorhus/first-chunk-stream"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "http://sindresorhus.com"
			},
			"engines": {
				"node": ">=0.10.0"
			},
			"scripts": {
				"test": "mocha"
			},
			"files": [
				"index.js"
			],
			"keywords": [
				"buffer",
				"stream",
				"streams",
				"transform",
				"first",
				"chunk",
				"size",
				"min",
				"minimum"
			],
			"devDependencies": {
				"concat-stream": "^1.4.5",
				"mocha": "*"
			},
			"gitHead": "79ca900b4d31074448dc7767eae79f1e605dca20",
			"bugs": {
				"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
			},
			"homepage": "https://github.com/sindresorhus/first-chunk-stream",
			"_id": "first-chunk-stream@0.1.0",
			"_shasum": "755d3ec14d49a86e3d2fcc08beead5c0ca2b9c0a",
			"_from": ".",
			"_npmVersion": "1.4.13",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"dist": {
				"shasum": "755d3ec14d49a86e3d2fcc08beead5c0ca2b9c0a",
				"tarball": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-0.1.0.tgz"
			},
			"directories": {},
			"contributors": []
		},
		"1.0.0": {
			"name": "first-chunk-stream",
			"version": "1.0.0",
			"description": "Transform the first chunk in a stream",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "https://github.com/sindresorhus/first-chunk-stream"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "http://sindresorhus.com"
			},
			"engines": {
				"node": ">=0.10.0"
			},
			"scripts": {
				"test": "mocha"
			},
			"files": [
				"index.js"
			],
			"keywords": [
				"buffer",
				"stream",
				"streams",
				"transform",
				"first",
				"chunk",
				"size",
				"min",
				"minimum"
			],
			"devDependencies": {
				"concat-stream": "^1.4.5",
				"mocha": "*"
			},
			"gitHead": "8b0b1750edcc30fa2b2071245198181e925be619",
			"bugs": {
				"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
			},
			"homepage": "https://github.com/sindresorhus/first-chunk-stream",
			"_id": "first-chunk-stream@1.0.0",
			"_shasum": "59bfb50cd905f60d7c394cd3d9acaab4e6ad934e",
			"_from": ".",
			"_npmVersion": "1.4.21",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"dist": {
				"shasum": "59bfb50cd905f60d7c394cd3d9acaab4e6ad934e",
				"tarball": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz"
			},
			"directories": {},
			"contributors": []
		},
		"2.0.0": {
			"name": "first-chunk-stream",
			"version": "2.0.0",
			"description": "Transform the first chunk in a stream",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/first-chunk-stream.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=0.10.0"
			},
			"scripts": {
				"test": "xo && mocha",
				"cover": "istanbul cover --report html _mocha -- test.js -R spec -t 5000"
			},
			"files": [
				"index.js"
			],
			"keywords": [
				"buffer",
				"stream",
				"streams",
				"transform",
				"first",
				"chunk",
				"size",
				"min",
				"minimum"
			],
			"dependencies": {
				"readable-stream": "^2.0.2"
			},
			"devDependencies": {
				"istanbul": "^0.3.19",
				"mocha": "*",
				"mocha-lcov-reporter": "0.0.2",
				"streamtest": "^1.2.1",
				"xo": "*"
			},
			"gitHead": "867c900661f90b4f50d1b2494f714f80933fc696",
			"bugs": {
				"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
			},
			"homepage": "https://github.com/sindresorhus/first-chunk-stream#readme",
			"_id": "first-chunk-stream@2.0.0",
			"_shasum": "1bdecdb8e083c0664b91945581577a43a9f31d70",
			"_from": ".",
			"_npmVersion": "2.14.3",
			"_nodeVersion": "4.1.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"shasum": "1bdecdb8e083c0664b91945581577a43a9f31d70",
				"tarball": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"directories": {},
			"contributors": []
		},
		"3.0.0": {
			"name": "first-chunk-stream",
			"version": "3.0.0",
			"description": "Transform the first chunk in a stream",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/first-chunk-stream.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=8"
			},
			"scripts": {
				"test": "xo && nyc ava && tsd"
			},
			"keywords": [
				"buffer",
				"stream",
				"streams",
				"transform",
				"first",
				"chunk",
				"size",
				"min",
				"minimum"
			],
			"devDependencies": {
				"@types/node": "^12.0.0",
				"ava": "^1.4.1",
				"nyc": "^14.0.0",
				"streamtest": "^1.2.1",
				"tsd": "^0.7.3",
				"xo": "^0.24.0"
			},
			"gitHead": "c34c62cbf812d3b7c034b4e82a6118c385be118a",
			"bugs": {
				"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
			},
			"homepage": "https://github.com/sindresorhus/first-chunk-stream#readme",
			"_id": "first-chunk-stream@3.0.0",
			"_nodeVersion": "8.16.0",
			"_npmVersion": "6.9.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"integrity": "sha512-LNRvR4hr/S8cXXkIY5pTgVP7L3tq6LlYWcg9nWBuW7o1NMxKZo6oOVa/6GIekMGI0Iw7uC+HWimMe9u/VAeKqw==",
				"shasum": "06972a66263505ed82b2c4db93c1b5e078a6576a",
				"tarball": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-3.0.0.tgz",
				"fileCount": 5,
				"unpackedSize": 9658,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc2CprCRA9TVsSAnZWagAAdzYP/0P767JdWWTRx28Mjyu4\nNfZXQVDLpEwRlzKi7aLZFviYNAheIAODBWuFcVnOdM5tUUzJcP50bMPvR6Y/\nPyFWn4TpvtTn/xcZ9J6YulFZ/POsw4LBoeAh4MQJ+/9Ev1W1qfAhKZ2jgUa0\nlSz1nuGVwtVl1MrNSWHnB8XBhGE7zuwuvglU6yfLnu6wiOC/xfMquSyVQpqO\nxFEFBfroC/bLCJXBRZzKvO5GRxCk9DyhvdbrO5a2FL5rdNY9E4Vnoa1fzjQJ\nLQIveSsN+f1v/080/Hij0I7i5lgkJbSitU5tBlK3MR3gd7Q7erRNuQyhGcoo\n7voeqC4rhFw8I+GDVvTcn0WQupp5Ui2Ll5TGcI5VOTkeyVeEY8jfAjCKKUjj\nOpGCMNhJlxv1Y7WHZKdotD7uKeOEzfSZTpTMFwWLHOkUix3WpKrN90QyN6nR\nv3pmfx0KK5A4Xc03hVD3GIAxrU2J8AO8aXSNdtgkG93sdKYrdM9j8OBeXgM+\nrnnPW9DqdIGo2dKwt7EBJMHuMtybrKgLUbZ6yOl2s6zczyX31WTjGPEYtTGz\npnuwUp5MdxjFNUhBx2ukbkU70xVs8CLpfSFGacvYB84jf5KaWEMvFeUln7So\nUPVC7HpQg4oND5IYawGbOFoa/kUneOvCIICPSVYjogVcw6JHNnEL9Mf0V7kC\nmhkT\r\n=XUyk\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/first-chunk-stream_3.0.0_1557670506283_0.4465839831807381"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		},
		"4.0.0": {
			"name": "first-chunk-stream",
			"version": "4.0.0",
			"description": "Buffer and transform the n first bytes of a stream",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/first-chunk-stream.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=8"
			},
			"scripts": {
				"test": "xo && nyc ava && tsd"
			},
			"keywords": [
				"buffer",
				"stream",
				"streams",
				"transform",
				"first",
				"chunk",
				"size",
				"min",
				"minimum",
				"bytes"
			],
			"devDependencies": {
				"@types/node": "^12.0.8",
				"ava": "^2.1.0",
				"nyc": "^14.0.0",
				"streamtest": "^1.2.1",
				"tsd": "^0.7.3",
				"xo": "^0.24.0"
			},
			"gitHead": "0f40e3d18ac9527a5efeca2f5a9fe25297a243dc",
			"bugs": {
				"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
			},
			"homepage": "https://github.com/sindresorhus/first-chunk-stream#readme",
			"_id": "first-chunk-stream@4.0.0",
			"_nodeVersion": "8.16.0",
			"_npmVersion": "6.9.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"integrity": "sha512-8TOz/mJp7+zc2HN63vnJHotwceq4gQI1+/gdJVnJcG4dEB96oUxw7wV9We4QKjSFWUc/V0ADDfaGba5cDoG6EA==",
				"shasum": "798e0b91a019a9421246ec4e4d25885c5d97912c",
				"tarball": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-4.0.0.tgz",
				"fileCount": 5,
				"unpackedSize": 10473,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdAfntCRA9TVsSAnZWagAAlX4QAJTepXC83+To++MC5lgz\n1q+RW8dAkTVHbHJq3+bPFIGPf5tmeI9GBX+WNQTHmo/ZQnvb8KY1+JqVdCvQ\n5HN/6UZBvWLjZjBWdShquyij8YLsHbHl/sgzgdMmgvcSCWbnmciRzNkyPTmq\nL7wApYUI0JTeEnjAmyHp0oVnitmYZYOHqiWvv+roFlRV+RE5cYrnDK7cNadj\nQfTbN4hsBXRDga9RnbfcqX5QpWo1ZQUuWVJGBnvnG9ZbD40qqgPr73B4gYrh\ncjlf/SjTnx3zMZkGcNi7qyHb7Rj+xH8OGcBBO0rA2fnRoGMahfFVLJj9CojD\ngaGQJjAcI9U6f0NRMfIimnU6GL5k8j1mflbKYaltZCL4LXvGS4irt8z68YQO\nfjKoRzbpYZ23WX/soaKsp+T34e5sxHYVPSNv7ue99aj2kvwC5Pk9mTE5jDae\nd4bLqD7HcbBTtX7MfjIU6hMumvdVj1dTQyYil+W9hCD1JxYwGo7buMx4rySR\nojUargc+nAVhMIEV/p+Y16+6KKRO+87x5OFemITxeWq82aXFppuyPb7w8l6G\n4CClpmlh9s/DZzo2jD+BJ8yMgq8ACiItgKPGj2XyHGyIDVpjyZdeaxNkZ6qD\n5o7yEkgwPwIdnVQXiLBh3kMWDm23j/77PFbN0+7oZiXvjdBOujfqhxoyAiux\nq7Pb\r\n=kSqW\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/first-chunk-stream_4.0.0_1560410604833_0.02719108546276816"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		}
	},
	"time": {
		"modified": "2019-06-13T07:23:27.549Z",
		"created": "2014-05-25T15:47:09.711Z",
		"0.1.0": "2014-05-25T15:47:09.711Z",
		"1.0.0": "2014-08-14T09:06:30.958Z",
		"2.0.0": "2015-09-20T16:31:11.197Z",
		"3.0.0": "2019-05-12T14:15:06.570Z",
		"4.0.0": "2019-06-13T07:23:24.939Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "4.0.0"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"6eae14efb89355bfddf5a1654ba9dbc2\"",
			"fetched": 1593324344124
		}
	},
	"_distfiles": {
		"first-chunk-stream-0.1.0.tgz": {
			"url": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-0.1.0.tgz",
			"sha": "755d3ec14d49a86e3d2fcc08beead5c0ca2b9c0a",
			"registry": "npmjs"
		},
		"first-chunk-stream-1.0.0.tgz": {
			"url": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
			"sha": "59bfb50cd905f60d7c394cd3d9acaab4e6ad934e",
			"registry": "npmjs"
		},
		"first-chunk-stream-2.0.0.tgz": {
			"url": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz",
			"sha": "1bdecdb8e083c0664b91945581577a43a9f31d70",
			"registry": "npmjs"
		},
		"first-chunk-stream-3.0.0.tgz": {
			"url": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-3.0.0.tgz",
			"sha": "06972a66263505ed82b2c4db93c1b5e078a6576a",
			"registry": "npmjs"
		},
		"first-chunk-stream-4.0.0.tgz": {
			"url": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-4.0.0.tgz",
			"sha": "798e0b91a019a9421246ec4e4d25885c5d97912c",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"first-chunk-stream-2.0.0.tgz": {
			"shasum": "1bdecdb8e083c0664b91945581577a43a9f31d70"
		}
	},
	"_rev": "2-22d93e9203a389ff",
	"_id": "first-chunk-stream",
	"readme": "# first-chunk-stream [![Build Status](https://travis-ci.org/sindresorhus/first-chunk-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/first-chunk-stream)\n\n> Buffer and transform the n first bytes of a stream\n\n\n## Install\n\n```\n$ npm install first-chunk-stream\n```\n\n\n## Usage\n\n```js\nconst fs = require('fs');\nconst getStream = require('get-stream');\nconst FirstChunkStream = require('first-chunk-stream');\n\n// unicorn.txt => unicorn rainbow\nconst stream = fs.createReadStream('unicorn.txt')\n\t.pipe(new FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\t\treturn chunk.toString(encoding).toUpperCase();\n\t}));\n\n(async () => {\n\tconst data = await getStream(stream);\n\n\tif (data.length < 7) {\n\t\tthrow new Error('Couldn\\'t get the minimum required first chunk length');\n\t}\n\n\tconsole.log(data);\n\t//=> 'UNICORN rainbow'\n})();\n```\n\n\n## API\n\n### FirstChunkStream(options, transform)\n\n`FirstChunkStream` constructor.\n\n#### transform(chunk, encoding)\n\nType: `Function`\n\nAsync function that receives the required `options.chunkSize` bytes.\n\nExpected to return an buffer-like object or `string` or object of form {buffer: `Buffer`, encoding: `string`} to send to stream or `firstChunkStream.stop` to end stream right away.\n\nAn error thrown from this function will be emitted as stream errors.\n\nNote that the buffer can have a smaller length than the required one. In that case, it will be due to the fact that the complete stream contents has a length less than the `options.chunkSize` value. You should check for this yourself if you strictly depend on the length.\n\n```js\nnew FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\treturn chunk.toString(encoding).toUpperCase(); // Send string to stream\n});\n\nnew FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\treturn chunk; // Send buffer to stream\n});\n\nnew FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\treturn {\n\t\tbuffer: chunk,\n\t\tencoding: encoding,\n\t}; // Send buffer with encoding to stream\n});\n\nnew FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\treturn FirstChunkStream.stop; // End the stream early\n});\n\nnew FirstChunkStream({chunkSize: 7}, async (chunk, encoding) => {\n\tthrow new Error('Unconditional error'); // Emit stream error\n});\n```\n\n#### options\n\nType: `object`\n\nThe options object is passed to the [`Duplex` stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) constructor allowing you to customize your stream behavior. In addition, you can specify the following option:\n\n###### chunkSize\n\nType: `number`\n\nHow many bytes you want to buffer."
}