-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
49 lines (49 loc) · 2.71 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
"name": "first-chunk-stream",
"version": "1.0.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": "*"
},
"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> 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",
"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": "first-chunk-stream@>=1.0.0 <2.0.0",
"_resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz"
}