{"_id":"stream-collector","_rev":"237177","name":"stream-collector","description":"Buffer data from a stream into an array if a callback is provided","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2023-03-24T16:33:38.000Z","created":"2014-11-15T10:28:10.519Z","1.0.1":"2014-11-15T10:35:01.896Z","1.0.0":"2014-11-15T10:28:10.519Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"https://github.com/mafintosh/stream-collector.git"},"versions":{"1.0.1":{"name":"stream-collector","version":"1.0.1","description":"Buffer data from a stream into an array if a callback is provided","main":"index.js","dependencies":{"once":"^1.3.1"},"devDependencies":{"tape":"^3.0.3","through2":"^0.6.3"},"scripts":{"test":"node test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/stream-collector.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/stream-collector/issues"},"homepage":"https://github.com/mafintosh/stream-collector","gitHead":"8a3da2f1058650dfd228d98f46d4f28544b5baa3","_id":"stream-collector@1.0.1","_shasum":"4d4e55f171356121b2c5f6559f944705ab28db15","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.33","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"dist":{"shasum":"4d4e55f171356121b2c5f6559f944705ab28db15","size":2117,"noattachment":false,"key":"/stream-collector/-/stream-collector-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/stream-collector/download/stream-collector-1.0.1.tgz"},"directories":{},"publish_time":1416047701896,"_hasShrinkwrap":false,"_cnpm_publish_time":1416047701896,"_cnpmcore_publish_time":"2021-12-16T23:53:02.446Z"},"1.0.0":{"name":"stream-collector","version":"1.0.0","description":"Buffer data from a stream into an array if a callback is provided","main":"index.js","dependencies":{"once":"^1.3.1"},"devDependencies":{"tape":"^3.0.3","through2":"^0.6.3"},"scripts":{"test":"node test.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/stream-collector.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/stream-collector/issues"},"homepage":"https://github.com/mafintosh/stream-collector","gitHead":"cd73d71fc42b0918377ddb01e30228c63de816da","_id":"stream-collector@1.0.0","_shasum":"81b608ab7711fe537177186d6c84632efe7e39f1","_from":".","_npmVersion":"2.1.7","_nodeVersion":"0.10.33","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":""}],"dist":{"shasum":"81b608ab7711fe537177186d6c84632efe7e39f1","size":1990,"noattachment":false,"key":"/stream-collector/-/stream-collector-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/stream-collector/download/stream-collector-1.0.0.tgz"},"directories":{},"publish_time":1416047290519,"_hasShrinkwrap":false,"_cnpm_publish_time":1416047290519,"_cnpmcore_publish_time":"2021-12-16T23:53:02.977Z"}},"readme":"# stream-collector\n\nBuffer `data` from a stream into an array if a callback is provided\n\n```\nnpm install stream-collector\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/stream-collector.svg?style=flat)](http://travis-ci.org/mafintosh/stream-collector)\n\n## Usage\n\n``` js\nvar collect = require('stream-collector')\n\ncollect(stream, function(err, list) {\n  // list contains all data chunks from stream  \n})\n```\n\nThe `stream` is always returned from the function. If a callback isn't provided no buffering will occur.\nThis allows you to do the following pattern where if you provide a callback the stream will be buffered (similar to how [request](https://github.com/mikeal/request) works)\n\n``` js\nvar read = function(cb) {\n  var stream = db.createReadStream()\n  return collect(stream, cb)\n}\n\nvar stream = read() // does not buffer\n\nread(function(err, list) {\n  // buffers the data\n})\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/stream-collector","bugs":{"url":"https://github.com/mafintosh/stream-collector/issues"},"license":"MIT"}