UNPKG

layaair2-cmd

Version:

layaair version 2 toolkit

103 lines (102 loc) 6.17 kB
{ "_args": [ [ { "raw": "stream-splicer@^2.0.0", "scope": null, "escapedName": "stream-splicer", "name": "stream-splicer", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "E:\\Mine\\Project\\git\\laya\\dawawa\\layaairdoc_cmd\\node_modules\\labeled-stream-splicer" ] ], "_from": "stream-splicer@>=2.0.0 <3.0.0", "_id": "stream-splicer@2.0.0", "_inCache": true, "_location": "/stream-splicer", "_nodeVersion": "2.4.0", "_npmUser": { "name": "substack", "email": "substack@gmail.com" }, "_npmVersion": "3.2.2", "_phantomChildren": { "core-util-is": "1.0.2", "inherits": "2.0.3", "process-nextick-args": "2.0.0", "safe-buffer": "5.1.2", "util-deprecate": "1.0.2" }, "_requested": { "raw": "stream-splicer@^2.0.0", "scope": null, "escapedName": "stream-splicer", "name": "stream-splicer", "rawSpec": "^2.0.0", "spec": ">=2.0.0 <3.0.0", "type": "range" }, "_requiredBy": [ "/labeled-stream-splicer" ], "_resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", "_shasum": "1b63be438a133e4b671cc1935197600175910d83", "_shrinkwrap": null, "_spec": "stream-splicer@^2.0.0", "_where": "E:\\Mine\\Project\\git\\laya\\dawawa\\layaairdoc_cmd\\node_modules\\labeled-stream-splicer", "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "bugs": { "url": "https://github.com/substack/stream-splicer/issues" }, "dependencies": { "inherits": "^2.0.1", "readable-stream": "^2.0.2" }, "description": "streaming pipeline with a mutable configuration", "devDependencies": { "JSONStream": "^1.0.4", "concat-stream": "^1.4.6", "split": "^1.0.0", "tape": "^4.2.0", "through2": "^2.0.0" }, "directories": {}, "dist": { "shasum": "1b63be438a133e4b671cc1935197600175910d83", "tarball": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz" }, "gitHead": "9fae7fdf051fc56a6a316416feda5be2291bf220", "homepage": "https://github.com/substack/stream-splicer", "keywords": [ "stream", "mutable", "pipeline" ], "license": "MIT", "main": "index.js", "maintainers": [ { "name": "substack", "email": "mail@substack.net" } ], "name": "stream-splicer", "optionalDependencies": {}, "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[![build status](https://travis-ci.org/substack/stream-splicer.png?branch=master)](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", "repository": { "type": "git", "url": "git://github.com/substack/stream-splicer.git" }, "scripts": { "test": "tape test/*.js" }, "version": "2.0.0" }