motion
Version:
motion - moving development forward
76 lines (75 loc) • 3.75 kB
JSON
{
"_args": [
[
"first-chunk-stream@https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "first-chunk-stream@>=1.0.0 <2.0.0",
"_id": "first-chunk-stream@1.0.0",
"_inCache": true,
"_location": "/first-chunk-stream",
"_phantomChildren": {},
"_requested": {
"name": "first-chunk-stream",
"raw": "first-chunk-stream@https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"rawSpec": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"type": "remote"
},
"_requiredBy": [
"/strip-bom-stream",
"/vinyl-fs/strip-bom"
],
"_resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"_shasum": "59bfb50cd905f60d7c394cd3d9acaab4e6ad934e",
"_shrinkwrap": null,
"_spec": "first-chunk-stream@https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/first-chunk-stream/issues"
},
"dependencies": {},
"description": "Transform the first chunk in a stream",
"devDependencies": {
"concat-stream": "^1.4.5",
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/first-chunk-stream#readme",
"keywords": [
"buffer",
"chunk",
"first",
"min",
"minimum",
"size",
"stream",
"streams",
"transform"
],
"license": "MIT",
"name": "first-chunk-stream",
"optionalDependencies": {},
"readme": "# first-chunk-stream [](https://travis-ci.org/sindresorhus/first-chunk-stream)\n\n> Transform the first chunk in a stream\n\nUseful if you want to do something to the first chunk.\n\nYou can also set the minimum size of that chunk.\n\n\n## Install\n\n```sh\n$ npm install --save first-chunk-stream\n```\n\n\n## Usage\n\n```js\nvar fs = require('fs');\nvar concat = require('concat-stream');\nvar firstChunk = require('first-chunk-stream');\n\n// unicorn.txt => unicorn rainbow\n// `highWaterMark: 1` means it will only read 1 byte at the time\nfs.createReadStream('unicorn.txt', {highWaterMark: 1})\n\t.pipe(firstChunk({minSize: 7}, function (chunk, enc, cb) {\n\t\tthis.push(chunk.toUpperCase());\n\t\tcb();\n\t}))\n\t.pipe(concat(function (data) {\n\t\tconsole.log(data);\n\t\t//=> UNICORN rainbow\n\t}));\n```\n\n\n## API\n\n### firstChunk([options], transform)\n\n#### options.minSize\n\nType: `number`\n\nThe minimum size of the first chunk.\n\n#### transform(chunk, encoding, callback)\n\n*Required* \nType: `function`\n\nThe [function](http://nodejs.org/docs/latest/api/stream.html#stream_transform_transform_chunk_encoding_callback) that gets the first chunk.\n\n### firstChunk.ctor()\n\nInstead of returning a [stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform_1) instance, `firstChunk.ctor()` returns a constructor for a custom Transform. This is useful when you want to use the same transform logic in multiple instances.\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/first-chunk-stream.git"
},
"scripts": {
"test": "mocha"
},
"version": "1.0.0"
}