-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
65 lines (65 loc) · 4.98 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
"name": "stream-splicer",
"version": "1.3.1",
"description": "streaming pipeline with a mutable configuration",
"main": "index.js",
"dependencies": {
"inherits": "^2.0.1",
"isarray": "~0.0.1",
"readable-stream": "^1.1.13-1",
"readable-wrap": "^1.0.0",
"through2": "^1.0.0",
"indexof": "0.0.1"
},
"devDependencies": {
"tape": "^2.12.1",
"JSONStream": "~0.8.2",
"concat-stream": "^1.4.6",
"split": "~0.3.0",
"object-keys": "~0.5.1"
},
"scripts": {
"test": "tape test/*.js"
},
"repository": {
"type": "git",
"url": "git://github.com/substack/stream-splicer.git"
},
"homepage": "https://github.com/substack/stream-splicer",
"keywords": [
"stream",
"mutable",
"pipeline"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT",
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8..latest",
"firefox/15",
"firefox/latest",
"firefox/nightly",
"chrome/15",
"chrome/latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
},
"readme": "# stream-splicer\n\nstreaming pipeline with a mutable configuration\n\nThis module is similar to\n[stream-combiner](https://npmjs.org/package/stream-combiner),\nbut with a pipeline configuration that can be changed at runtime.\n\n[![testling badge](https://ci.testling.com/substack/stream-splicer.png)](https://ci.testling.com/substack/stream-splicer)\n\n[![build status](https://secure.travis-ci.org/substack/stream-splicer.png)](http://travis-ci.org/substack/stream-splicer)\n\n# example\n\nThis example begins with an HTTP header parser that waits for an empty line to\nsignify the end of the header. At that point, it switches to a streaming json\nparser to operate on the HTTP body.\n\n``` js\nvar splicer = require('stream-splicer');\nvar through = require('through2');\nvar JSONStream = require('JSONStream');\nvar split = require('split');\n\nvar headerData = {};\nvar headers = through.obj(function (buf, enc, next) {\n var line = buf.toString('utf8');\n if (line === '') {\n this.push(headerData);\n pipeline.splice(1, 1, JSONStream.parse([ 'rows', true ]));\n }\n else {\n var m = /^(\\S+):(.+)/.exec(line);\n var key = m && m[1].trim();\n var value = m && m[2].trim();\n if (m) headerData[key] = value;\n }\n next();\n});\nvar pipeline = splicer([ split(), headers, JSONStream.stringify() ]);\nprocess.stdin.pipe(pipeline).pipe(process.stdout);\n```\n\nintput:\n\n```\nGET / HTTP/1.1\nHost: substack.net\nUser-Agent: echo\n\n{\"rows\":[\"beep\",\"boop\"]}\n```\n\noutput:\n\n```\n$ echo -ne 'GET / HTTP/1.1\\nHost: substack.net\\nUser-Agent: echo\\n\\n{\"rows\":[\"beep\",\"boop\"]}\\n' | node example/header.js\n[\n{\"Host\":\"substack.net\",\"User-Agent\":\"echo\"}\n,\n\"beep\"\n,\n\"boop\"\n]\n```\n\n# methods\n\n``` js\nvar splicer = require('stream-splicer')\n```\n\n## var pipeline = splicer(streams, opts)\n\nCreate a `pipeline` duplex stream given an array of `streams`. Each `stream`\nwill be piped to the next. Writes to `pipeline` get written to the first stream\nand data for reads from `pipeline` come from the last stream.\n\nFor example, for streams `[ a, b, c, d ]`, this pipeline is constructed\ninternally:\n\n```\na.pipe(b).pipe(c).pipe(d)\n```\n\nInput will get written into `a`. Output will be read from `d`.\n\nIf any of the elements in `streams` are arrays, they will be converted into\nnested pipelines. This is useful if you want to expose a hookable pipeline with\ngrouped insertion points.\n\n## var pipeline = splicer.obj(streams, opts)\n\nCreate a `pipeline` with `opts.objectMode` set to true for convenience.\n\n## var removed = pipeline.splice(index, howMany, stream, ...)\n\nSplice the pipeline starting at `index`, removing `howMany` streams and\nreplacing them with each additional `stream` argument provided.\n\nThe streams that were removed from the splice and returned.\n\n## pipeline.push(stream, ...)\n\nPush one or more streams to the end of the pipeline.\n\n## var stream = pipeline.pop()\n\nPop a stream from the end of the pipeline.\n\n## pipeline.unshift(stream, ...)\n\nUnshift one or more streams to the begining of the pipeline.\n\n## var stream = pipeline.shift()\n\nShift a stream from the begining of the pipeline.\n\n## var stream = pipeline.get(index, ...)\n\nReturn the stream at index `index, ...`. Indexes can be negative.\n\nMultiple indexes will traverse into nested pipelines.\n\n# attributes\n\n## pipeline.length\n\nThe number of streams in the pipeline\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install stream-splicer\n```\n\n# license\n\nMIT\n",
"readmeFilename": "readme.markdown",
"bugs": {
"url": "https://github.com/substack/stream-splicer/issues"
},
"_id": "stream-splicer@1.3.1",
"_from": "stream-splicer@^1.1.0"
}