2017-08-21 08:50:25 +08:00

91 lines
4.5 KiB
JSON

{
"_args": [
[
{
"raw": "fork-stream@^0.0.4",
"scope": null,
"escapedName": "fork-stream",
"name": "fork-stream",
"rawSpec": "^0.0.4",
"spec": ">=0.0.4 <0.0.5",
"type": "range"
},
"D:\\web\\layui\\res\\layui\\node_modules\\ternary-stream"
]
],
"_from": "fork-stream@>=0.0.4 <0.0.5",
"_id": "fork-stream@0.0.4",
"_inCache": true,
"_location": "/fork-stream",
"_npmUser": {
"name": "deoxxa",
"email": "deoxxa@fknsrs.biz"
},
"_npmVersion": "1.2.32",
"_phantomChildren": {},
"_requested": {
"raw": "fork-stream@^0.0.4",
"scope": null,
"escapedName": "fork-stream",
"name": "fork-stream",
"rawSpec": "^0.0.4",
"spec": ">=0.0.4 <0.0.5",
"type": "range"
},
"_requiredBy": [
"/ternary-stream"
],
"_resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz",
"_shasum": "db849fce77f6708a5f8f386ae533a0907b54ae70",
"_shrinkwrap": null,
"_spec": "fork-stream@^0.0.4",
"_where": "D:\\web\\layui\\res\\layui\\node_modules\\ternary-stream",
"author": {
"name": "Conrad Pankoff",
"email": "deoxxa@fknsrs.biz",
"url": "http://www.fknsrs.biz/"
},
"bugs": {
"url": "https://github.com/deoxxa/fork-stream/issues"
},
"dependencies": {},
"description": "Fork a stream in multiple directions according to a function",
"devDependencies": {
"chai": "~1.7.2",
"mocha": "~1.12.1"
},
"directories": {},
"dist": {
"shasum": "db849fce77f6708a5f8f386ae533a0907b54ae70",
"tarball": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz"
},
"homepage": "https://github.com/deoxxa/fork-stream#readme",
"keywords": [
"stream",
"fork",
"split",
"function",
"conditional"
],
"license": "BSD",
"main": "index.js",
"maintainers": [
{
"name": "deoxxa",
"email": "deoxxa@fknsrs.biz"
}
],
"name": "fork-stream",
"optionalDependencies": {},
"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",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/deoxxa/fork-stream.git"
},
"scripts": {
"test": "mocha -R tap"
},
"version": "0.0.4"
}