{"name":"pfork","description":"fork process","version":"0.6.3","main":"lib/index.js","author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"contributors":[],"license":"MIT","homepage":"https://github.com/avwo/pfork","keywords":["child_process","fork","process"],"scripts":{"lint":"eslint ./lib index.js","lintfix":"eslint --fix ./lib index.js"},"registry":"http://registry.npmjs.org/pfork","repository":{"type":"git","url":"git+https://github.com/avwo/pfork.git"},"engines":{"node":">= 0.12.0"},"devDependencies":{"eslint":"^2.13.1"},"_id":"pfork@0.6.3","gitHead":"a765dc2581a15067fe6f170e6cc8ee4517c2e804","bugs":{"url":"https://github.com/avwo/pfork/issues"},"_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-zK1eUVtdFIcccvvAn1crKmS6Z0N8d2Tn9xt+9MrfyeljoVci5BfLNEc/EktE0BKueyOa5VFl/jlSgVTHDxZFDA==","shasum":"763cda93d7d39efc3aa62f518352999e0dd903b8","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.6.3.tgz","fileCount":7,"unpackedSize":13371,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBVgMRpsnQa5AtydPzieGsR7Acb5vlO6lMUwlEsNGUBUAiEA+r84R6C7th4GmC6mhnov1iiNAvEXNXX46fU2ffBzw6c="}],"size":4758,"noattachment":false,"key":"/pfork/-/pfork-0.6.3.tgz"},"_npmUser":{"name":"avwu","email":"avenwu@vip.qq.com"},"directories":{},"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pfork_0.6.3_1767240812017_0.8630091011930374"},"_hasShrinkwrap":false,"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":1767240812175,"_cnpm_publish_time":1767240812175,"dist-tags":{"latest":"0.6.3"}}