{"name":"pfork","version":"0.0.2","keywords":["child_process","fork"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.0.2","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"09c962d64ad36c2172cb092664373e92a15044d5","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.0.2.tgz","integrity":"sha512-AgpzPTdJeMFPfS00Xgtjioz2T09FfMUfcdo3CeScHahnp4iiwl2a7Yy4I/5cCTJYY8MFFqJK4tEzaT3X4W57bA==","signatures":[{"sig":"MEUCIQD17O0nB1xMd9mSCSB82/lD+J0HCl94dLb2EmQU5mMvGAIgFCPvncjJRlM+VzdhwmQgZLO+R3+F5g4utNMwgJVby+I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":2812,"noattachment":false,"key":"/pfork/-/pfork-0.0.2.tgz"},"main":"lib/index.js","_from":".","_shasum":"09c962d64ad36c2172cb092664373e92a15044d5","engines":{"node":">= 0.10.0"},"gitHead":"5c359017438987d2f9535b80e7469682cf0c2308","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":"2.14.12","description":"fork process","directories":{},"_nodeVersion":"4.2.4","dependencies":{"q":"^1.4.1"},"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":1453560464492,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1453560464492,"dist-tags":{"latest":"0.6.3"}}