{"bugs":{"url":"https://github.com/deoxxa/fork-stream/issues"},"dist":{"shasum":"db849fce77f6708a5f8f386ae533a0907b54ae70","tarball":"https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz","integrity":"sha512-Pqq5NnT78ehvUnAk/We/Jr22vSvanRlFTpAmQ88xBY/M1TlHe+P0ILuEyXS595ysdGfaj22634LBkGMA2GTcpA==","signatures":[{"sig":"MEUCIFwYEXWidQRmIKClUXavoV1C1mqAyjQ+oFLk2hQuTGEKAiEA3huyiS4Q7DZMPGCesfkM/F9t2QBa7UM5xyPkGFftiEM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","name":"fork-stream","_from":".","author":{"url":"http://www.fknsrs.biz/","name":"Conrad Pankoff","email":"deoxxa@fknsrs.biz"},"readme":"fork-stream [![build status](https://travis-ci.org/deoxxa/fork-stream.png)](https://travis-ci.org/deoxxa/fork-stream)\n===========\n\nFork a stream in multiple directions according to a function.\n\nOverview\n--------\n\nfork-stream basically gives you conditional branching for streams. You supply\nthe logic, fork-stream supplies the streaming.\n\nSuper Quickstart\n----------------\n\nCode:\n\n```javascript\nvar ForkStream = require(\"fork-stream\");\n\nvar fork = new ForkStream({\n  classifier: function classify(e, done) {\n    return done(null, e.match(/[aeiou]/));\n  },\n});\n\nfork.a.on(\"data\", console.log.bind(console, \"vowels:\"));\nfork.b.on(\"data\", console.log.bind(console, \"no vowels:\"));\n\nfork.write(\"hello\");\nfork.write(\"zxcbzz\");\nfork.write(\"ooooooo\");\n\nfork.end();\n```\n\nOutput:\n\n```\nvowels: hello\nno vowels: zxcbzz\nvowels: ooooooo\n```\n\nInstallation\n------------\n\nAvailable via [npm](http://npmjs.org/):\n\n> $ npm install fork-stream\n\nOr via git:\n\n> $ git clone git://github.com/deoxxa/fork-stream.git node_modules/fork-stream\n\nAPI\n---\n\n**constructor**\n\nCreates a new fork-stream.\n\n```javascript\nnew ForkStream(options);\n```\n\n```javascript\nvar fork = new ForkStream({\n  highWaterMark: 5,\n  classifier: function(e, done) {\n    return done(null, !!e);\n  },\n});\n```\n\n* _options_ - regular stream options, and a `classifier` property that\n  fork-stream will use to decide what output stream to send your object down.\n\nExample\n-------\n\nAlso see [example.js](https://github.com/deoxxa/fork-stream/blob/master/example.js).\n\n```javascript\nvar ForkStream = require(\"fork-stream\");\n\nvar fork = new ForkStream({\n  classifier: function classify(e, done) {\n    return done(null, e >= 5);\n  },\n});\n\nfork.a.on(\"data\", console.log.bind(null, \"a\"));\nfork.b.on(\"data\", console.log.bind(null, \"b\"));\n\nfor (var i=0;i<20;++i) {\n  fork.write(Math.round(Math.random() * 10));\n}\n```\n\nOutput:\n\n```\nb 1\na 6\na 9\na 10\na 7\na 5\nb 2\nb 4\na 8\nb 3\na 5\nb 4\na 7\na 8\nb 1\na 6\nb 2\nb 0\na 5\nb 1\n```\n\nLicense\n-------\n\n3-clause BSD. A copy is included with the source.\n\nContact\n-------\n\n* GitHub ([deoxxa](http://github.com/deoxxa))\n* Twitter ([@deoxxa](http://twitter.com/deoxxa))\n* Email ([deoxxa@fknsrs.biz](mailto:deoxxa@fknsrs.biz))\n","license":"BSD","scripts":{"test":"mocha -R tap"},"_npmUser":{"name":"deoxxa","email":"deoxxa@fknsrs.biz"},"keywords":["stream","fork","split","function","conditional"],"repository":{"url":"git://github.com/deoxxa/fork-stream.git","type":"git"},"_npmVersion":"1.2.32","description":"Fork a stream in multiple directions according to a function","maintainers":[{"name":"deoxxa","email":"deoxxa@fknsrs.biz"}],"readmeFilename":"README.md","devDependencies":{"chai":"~1.7.2","mocha":"~1.12.1"},"_id":"fork-stream@0.0.4","version":"0.0.4"}