{
  "name": "lazystream",
  "version": "0.1.0",
  "description": "Open Node Streams on demand.",
  "homepage": "https://github.com/jpommerening/node-lazystream",
  "author": {
    "name": "J. Pommerening"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/jpommerening/node-lazystream.git"
  },
  "bugs": {
    "url": "https://github.com/jpommerening/node-lazystream/issues"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/jpommerening/node-lazystream/blob/master/LICENSE-MIT"
    }
  ],
  "main": "lib/lazystream.js",
  "engines": {
    "node": ">= 0.6.3"
  },
  "scripts": {
    "test": "nodeunit test/readable_test.js test/writable_test.js test/pipe_test.js test/fs_test.js"
  },
  "dependencies": {
    "readable-stream": "~1.0.2"
  },
  "devDependencies": {
    "nodeunit": "~0.7.4"
  },
  "keywords": [
    "streams",
    "stream"
  ],
  "readme": "# Lazy Streams\n\n> *Create streams lazily when they are read from or written to.*  \n> `lazystream: 0.0.2` [![Build Status](https://travis-ci.org/jpommerening/node-lazystream.png?branch=master)](https://travis-ci.org/jpommerening/node-lazystream)  \n\n## Why?\n\nSometimes you feel the itch to open *all the files* at once. You want to pass a bunch of streams around, so the consumer does not need to worry where the data comes from.\nFrom a software design point-of-view this sounds entirely reasonable. Then there is that neat little function `fs.createReadStream()` that opens a file and gives you a nice `fs.ReadStream` to pass around, so you use what the mighty creator deities of node bestowed upon you.\n\n> `Error: EMFILE, too many open files`  \n> ─ *node*\n\nThis package provides two classes based on the node's new streams API (or `readable-stream` if you are using node a node version earlier than 0.10):\n\n## Class: lazystream.Readable\n\nA wrapper for readable streams. Extends [`stream.PassThrough`](http://nodejs.org/api/stream.html#stream_class_stream_passthrough).\n\n### new lazystream.Readable(fn [, options])\n\n* `fn` *{Function}*  \n  The function that the lazy stream will call to obtain the stream to actually read from.\n* `options` *{Object}*  \n  Options for the underlying `PassThrough` stream, accessible by `fn`.\n\nCreates a new readable stream. Once the stream is accessed (for example when you call its `read()` method, or attach a `data`-event listener) the `fn` function is called with the outer `lazystream.Readable` instance bound to `this`.\n\nIf you pass an `options` object to the constuctor, you can access it in your `fn` function.\n\n```javascript\nnew lazystream.Readable(function (options) {\n  return fs.createReadStream('/dev/urandom');\n});\n```\n\n## Class: lazystream.Writable\n\nA wrapper for writable streams. Extends [`stream.PassThrough`](http://nodejs.org/api/stream.html#stream_class_stream_passthrough).\n\n### new lazystream.Writable(fn [, options])\n\n* `fn` *{Function}*  \n  The function that the lazy stream will call to obtain the stream to actually write to.\n* `options` *{Object}*  \n  Options for the underlying `PassThrough` stream, accessible by `fn`.\n\nCreates a new writable stream. Just like the one above but for writable streams.\n\n```javascript\nnew lazystream.Writable(function () {\n  return fs.createWriteStream('/dev/null');\n});\n```\n\n## Install\n\n```console\n$ npm install lazystream --save\nnpm http GET https://registry.npmjs.org/readable-stream\nnpm http 200 https://registry.npmjs.org/readable-stream\nnpm http GET https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.2.tgz\nnpm http 200 https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.2.tgz\nlazystream@0.0.2 node_modules/lazystream\n└── readable-stream@1.0.2\n```\n\n## Contributing\n\nFork it, branch it, send me a pull request. We'll work out the rest together.\n\n## Credits\n\n[Chris Talkington](https://github.com/ctalkington) and his [node-archiver](https://github.com/ctalkington/node-archiver) for providing a use-case.\n\n## [License](LICENSE-MIT)\n\nCopyright (c) 2013 J. Pommerening, contributors.\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n",
  "readmeFilename": "README.md",
  "_id": "lazystream@0.1.0",
  "dist": {
    "shasum": "84f9f6c9294d67dea865dec9c6861e00264c58ec"
  },
  "_from": "lazystream@~0.1.0",
  "_resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz"
}
