{"name":"pfork","version":"0.0.4","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.0.4","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"1dff191f686c9785090c62615cdf71e23f5d7d3b","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.0.4.tgz","integrity":"sha512-JcgTVbSxYGVJ4x9smFS4p386+5vhfsOdJEnw0NU2AaIKbfcTskaDaqaeTweKvgAe3hES6ma8U9/QOTrwrA62kQ==","signatures":[{"sig":"MEUCIQCmi7jy7X1QqJoZkMamn5EsYSUTuV46bZTxcHtC0FuzRgIgOkBn+j6siMIpYj20xH7Dka59w25UaL54awz4Vrucf80=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"size":3396,"noattachment":false,"key":"/pfork/-/pfork-0.0.4.tgz"},"main":"lib/index.js","_from":".","_shasum":"1dff191f686c9785090c62615cdf71e23f5d7d3b","engines":{"node":">= 0.10.0"},"gitHead":"f49c0004775ac164abd918e9fe29313b01548a63","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":1453692503744,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1453692503744,"dist-tags":{"latest":"0.6.3"}}