{"name":"pfork","version":"0.1.6","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.1.6","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"07e294caba832ddb6dd828872aca15bba337e75b","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.1.6.tgz","integrity":"sha512-erZWI0Oya+illZug/BSHd9CdWVcsGkbYJ+F7HTPN90d13vK0Iymp/eeswDgXBziBTkgHstgseggwtC+KyvCxKg==","signatures":[{"sig":"MEQCIGowFiXufMcBB0qRf8j/JZH1Bn3IuUsxBI6V+din/GciAiAavuXCQpHsrtn7WR1OBzOU7GFo+9Q3gBEk50JTTrIYvw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3728,"noattachment":false,"key":"/pfork/-/pfork-0.1.6.tgz"},"main":"lib/index.js","_from":".","_shasum":"07e294caba832ddb6dd828872aca15bba337e75b","engines":{"node":">= 0.10.0"},"gitHead":"2dfe9d4d3aab9e20c6375d25e4c543cf02759ff8","scripts":{},"_npmUser":{"name":"avwu","email":"avenwu@vip.qq.com"},"registry":"http://registry.npmjs.org/pfork","repository":{"url":"git+https://github.com/avwo/pfork.git","type":"git"},"_npmVersion":"4.1.2","description":"fork process","directories":{},"_nodeVersion":"7.7.3","dependencies":{"q":"^1.4.1"},"_npmOperationalInternal":{"tmp":"tmp/pfork-0.1.6.tgz_1500379660599_0.17624685168266296","host":"s3://npm-registry-packages"},"readme":"# pfork\n用于在后台运行程序中启动一个进程执行相应的脚本\n\n# Installation\n\n\tnpm install pfork --save\n\t\n# Usage\n\tvar p = require('pfork');\n\tvar options = {\n\t\tscript: '/User/xxx/test/script.js', //必填\n\t\tvalue: '/User/xxx/test/server.js',  //可选\n\t\t//其它字段\n\t};\n\t//会根据script和value自动去重\n\tp.fork(options, function(err, data, child) {\n\t\t//启动结束\n\t\t//child.on('data', function(data) {});\n\t\t//child.sendData(data);\n\t\t//child.on('exit', function() {}); //退出的时候\n\t});\n\t\n/User/xxx/test/script.js\n\n\t//options与fork的options字段一致\n\tmodule.exports = function(options, callback) {\n\t\t//do sth\n\t\t// process.sendData(data);\n\t\tcallback(err, data);\n\t}；\n\t\nkill process：\n\n\tp.kill({\n\t\tscript: '/User/xxx/test/script.js',\n\t\tvalue: '/User/xxx/test/server.js'\n\t});\n\t\n判断进程是否已存在：\n\n\tp.exists({\n\t\tscript: '/User/xxx/test/script.js',\n\t\tvalue: '/User/xxx/test/server.js'\n\t});\n\n\t","publish_time":1500379662522,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1500379662522,"dist-tags":{"latest":"0.6.3"}}