{"dist":{"shasum":"e0258705953cdfff2caa354777cd2865d13040f6","tarball":"https://registry.npmjs.org/flower/-/flower-0.4.1.tgz","integrity":"sha512-xw+oX5hsSyJi6dHu5P9kx/7jGpcHApHCGngSav3Zfdeso292BhjcJL1Fe53LzctVsB8ryuJW9/SLBHz3p2o7gg==","signatures":[{"sig":"MEQCIByuTYHvxH5tMWiQLdNu8IdQkTKJcp1+ZS5AoSDCPd0VAiBw8T7v5whcXFHxqL/6p3sscUkxCz/jcxeHFBJkrHz5tA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./flower.js","name":"flower","author":{"name":"Andreas Madsen","email":"amwebdk@gmail.com"},"readme":"#flowers\n\n**flowers is a collection of stream helpers.**\n\n## Installation\n\n```sheel\nnpm install flowers\n```\n\n##API documentation\n\n### flowers.relayReadStream()\n\n_Also available as javascript constructor at `flowers.RelayReadStream()`_\n\nWill return a `ReadStream` object there does except for relaying pipe output.\n\nThe main usercase is that you expose function there don't have a callback\nbut returns a stream. However you have to do an async operation before\ncreateing the readstream, so you can't return the stream object directly.\n\n```JavaScript\nexports.read = function () {\n  var relay = flowers.relayReadStream();\n\n  process.nextTick(function () {\n    fs.createReadStream('file.txt').pipe(relay);\n  });\n\n  return relay;\n};\n```\n\n### flowers.memoryStream()\n\n_Also available as javascript constructor at `flowers.MemoryStream()`_\n\nreturns `WriteStream` that you can pipe to using a `ReadStream`. The data chunks\nwill be stored seperatly in the `memoryStream`, on the same time or after data are\nbeing piped to the `memoryStream` you can create a new `ReadStream` from it by using\n``memoryStream.relay()`, the returned `ReadStream` will then emit the stored an new\nchunks in propper order.\n\nNote add chunks are writen to the `memoryStream` its `size` property will increase. This\nproperty contains the total buffer size.\n\nExample of how this can be used to implement a filecache\n\n```JavaScript\nvar filecache = {};\n\nfunction request(filename) {\n  if (filecache[filename] === undefined) {\n    filecache[filename] = flower.memoryStream();\n    fs.createReadStream(filename).pipe(filecache[filename]);\n  }\n  return filecache[filename].relay();\n}\n\n// request files\nrequest('file.txt');\n\n//multiply request will share the filestream\nrequest('file.txt');\nrequest('file.txt');\n```\n\n### flowers.buffer2stream(buffer, [options])\n\n_Also available as javascript constructor at `flowers.Buffer2stream()`_\n\nTakes a buffer or string and splits it up intro chunks there is emitted in\na `ReadStream` object.\n\nThe `options` object takes a `chunkSize` property there tell how big each chunk\nshould be in bytes. By default this is `64 * 1024`.\n\n```JavaScript\nvar stream = flowers.buffer2stream(buffer);\n\nstream.pipe(fs.createWriteStream('file.txt'));\n};\n```\n\n### flowers.stream2buffer(stream, callback)\n\nTakes a `ReadStream` and buffer it up until the stream is closed or an error occurred.\nThe buffer is then send as a callback argument.\n\nThe `callback` have two arguments `error` and `buffer`.\n\nThe `options` object takes a `chunkSize` property there tell how big each chunk\nshould be in bytes. By default this is `64 * 1024`.\n\n```JavaScript\nvar stream = fs.createReadStream('file.txt');\n\nflowers.stream2buffer(stream, function (error, buffer) {\n\n});\n```\n\n##License\n\n**The software is license under \"MIT\"**\n\n> Copyright (c) 2012 Andreas Madsen\n>\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n> THE SOFTWARE.\n","engines":{"npm":"1","node":"0.6 || 0.7 || 0.8"},"license":"MIT","scripts":{"test":"vows test/simple/* --spec --isolate"},"_npmUser":{"name":"andreasmadsen","email":"amwebdk@gmail.com"},"keywords":["stream","buffer","pipe","convert"],"repository":{"url":"git://github.com/AndreasMadsen/flower.git","type":"git"},"_npmVersion":"1.1.24","description":"Collection of stream classes and functions","maintainers":[{"name":"andreasmadsen","email":"amwebdk@gmail.com"}],"_nodeVersion":"v0.7.10-pre","dependencies":{},"_defaultsLoaded":true,"devDependencies":{"vows":"0.6.x","wrench":"1.3.x"},"_engineSupported":true,"optionalDependencies":{},"_id":"flower@0.4.1","version":"0.4.1"}