{ "_args": [ [ { "raw": "combined-stream@~1.0.5", "scope": null, "escapedName": "combined-stream", "name": "combined-stream", "rawSpec": "~1.0.5", "spec": ">=1.0.5 <1.1.0", "type": "range" }, "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/request" ] ], "_from": "combined-stream@>=1.0.5 <1.1.0", "_id": "combined-stream@1.0.5", "_inCache": true, "_location": "/combined-stream", "_nodeVersion": "0.12.4", "_npmUser": { "name": "alexindigo", "email": "iam@alexindigo.com" }, "_npmVersion": "2.10.1", "_phantomChildren": {}, "_requested": { "raw": "combined-stream@~1.0.5", "scope": null, "escapedName": "combined-stream", "name": "combined-stream", "rawSpec": "~1.0.5", "spec": ">=1.0.5 <1.1.0", "type": "range" }, "_requiredBy": [ "/form-data", "/request" ], "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", "_shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", "_shrinkwrap": null, "_spec": "combined-stream@~1.0.5", "_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/request", "author": { "name": "Felix Geisendörfer", "email": "felix@debuggable.com", "url": "http://debuggable.com/" }, "bugs": { "url": "https://github.com/felixge/node-combined-stream/issues" }, "dependencies": { "delayed-stream": "~1.0.0" }, "description": "A stream that emits multiple other streams one after another.", "devDependencies": { "far": "~0.0.7" }, "directories": {}, "dist": { "shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", "tarball": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz" }, "engines": { "node": ">= 0.8" }, "gitHead": "cfc7b815d090a109bcedb5bb0f6713148d55a6b7", "homepage": "https://github.com/felixge/node-combined-stream", "license": "MIT", "main": "./lib/combined_stream", "maintainers": [ { "name": "felixge", "email": "felix@debuggable.com" }, { "name": "celer", "email": "dtyree77@gmail.com" }, { "name": "alexindigo", "email": "iam@alexindigo.com" }, { "name": "apechimp", "email": "apeherder@gmail.com" } ], "name": "combined-stream", "optionalDependencies": {}, "readme": "# combined-stream\n\nA stream that emits multiple other streams one after another.\n\n**NB** Currently `combined-stream` works with streams vesrion 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatability with `combined-stream`.\n\n- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module.\n\n- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another.\n\n## Installation\n\n``` bash\nnpm install combined-stream\n```\n\n## Usage\n\nHere is a simple example that shows how you can use combined-stream to combine\ntwo files into one:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nWhile the example above works great, it will pause all source streams until\nthey are needed. If you don't want that to happen, you can set `pauseStreams`\nto `false`:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create({pauseStreams: false});\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nHowever, what if you don't have all the source streams yet, or you don't want\nto allocate the resources (file descriptors, memory, etc.) for them right away?\nWell, in that case you can simply provide a callback that supplies the stream\nby calling a `next()` function:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file1.txt'));\n});\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file2.txt'));\n});\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\n## API\n\n### CombinedStream.create([options])\n\nReturns a new combined stream object. Available options are:\n\n* `maxDataSize`\n* `pauseStreams`\n\nThe effect of those options is described below.\n\n### combinedStream.pauseStreams = `true`\n\nWhether to apply back pressure to the underlaying streams. If set to `false`,\nthe underlaying streams will never be paused. If set to `true`, the\nunderlaying streams will be paused right after being appended, as well as when\n`delayedStream.pipe()` wants to throttle.\n\n### combinedStream.maxDataSize = `2 * 1024 * 1024`\n\nThe maximum amount of bytes (or characters) to buffer for all source streams.\nIf this value is exceeded, `combinedStream` emits an `'error'` event.\n\n### combinedStream.dataSize = `0`\n\nThe amount of bytes (or characters) currently buffered by `combinedStream`.\n\n### combinedStream.append(stream)\n\nAppends the given `stream` to the combinedStream object. If `pauseStreams` is\nset to `true, this stream will also be paused right away.\n\n`streams` can also be a function that takes one parameter called `next`. `next`\nis a function that must be invoked in order to provide the `next` stream, see\nexample above.\n\nRegardless of how the `stream` is appended, combined-stream always attaches an\n`'error'` listener to it, so you don't have to do that manually.\n\nSpecial case: `stream` can also be a String or Buffer.\n\n### combinedStream.write(data)\n\nYou should not call this, `combinedStream` takes care of piping the appended\nstreams into itself for you.\n\n### combinedStream.resume()\n\nCauses `combinedStream` to start drain the streams it manages. The function is\nidempotent, and also emits a `'resume'` event each time which usually goes to\nthe stream that is currently being drained.\n\n### combinedStream.pause();\n\nIf `combinedStream.pauseStreams` is set to `false`, this does nothing.\nOtherwise a `'pause'` event is emitted, this goes to the stream that is\ncurrently being drained, so you can use it to apply back pressure.\n\n### combinedStream.end();\n\nSets `combinedStream.writable` to false, emits an `'end'` event, and removes\nall streams from the queue.\n\n### combinedStream.destroy();\n\nSame as `combinedStream.end()`, except it emits a `'close'` event instead of\n`'end'`.\n\n## License\n\ncombined-stream is licensed under the MIT license.\n", "readmeFilename": "Readme.md", "repository": { "type": "git", "url": "git://github.com/felixge/node-combined-stream.git" }, "scripts": { "test": "node test/run.js" }, "version": "1.0.5" }