{"name":"stream-splicer","version":"1.3.0","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"]},"gitHead":"e8159323562005f9c695a5e0ec3e468329daac6c","bugs":{"url":"https://github.com/substack/stream-splicer/issues"},"_id":"stream-splicer@1.3.0","_shasum":"4839f2f03c4137b3896d064a4d927807a3b95b21","_from":".","_npmVersion":"1.4.15","_npmUser":{"name":"substack","email":"mail@substack.net"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"dist":{"shasum":"4839f2f03c4137b3896d064a4d927807a3b95b21","tarball":"http://registry-npm.ywwl.com/stream-splicer/download/stream-splicer-1.3.0.tgz","integrity":"sha512-UmcjaqT+vCsf+e1snl4YTX1iVI34CXTqtC22mUtv4c3cxee6sEgu15dPywjIvmfrKOhz8cxfkzK3DlJ6OVg3Bg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICE+nPd1vcAHBV/yZnrxX/KBvpvYqZuO13veX39o0D+cAiEAs5EIedimy5K+TYrWfC6wHF+m77AQgT+l6bVdHfKvZEg="}],"size":6208,"noattachment":false,"key":"/stream-splicer/-/stream-splicer-1.3.0.tgz"},"directories":{},"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/browserify/stream-splicer.png?branch=master)](http://travis-ci.org/browserify/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('jsonstream2');\nvar split = require('split2');\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","publish_time":1402893941126,"_cnpm_publish_time":1402893941126,"dist-tags":{"latest":"2.0.1"}}