{"name":"pfork","description":"fork process","version":"0.6.2","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.2","gitHead":"e4556533be2c0177a1decfaf7ef8cd7579936ea9","bugs":{"url":"https://github.com/avwo/pfork/issues"},"_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-+r6dKpeOCyaZfyB137SpwG5i5CnkNQnis9nSASOl1uAYSyb20Rlb9cGFuu9oqIfQPfaCjEEDXY6szGI+J6oHSQ==","shasum":"ee036fbdf1b32fbdbfee93647f2043ac426341a7","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.6.2.tgz","fileCount":7,"unpackedSize":13201,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvMYItCDxMHpYD5AWUuIb7Xdl7mOx2jVcmwFjLvgA2HQIhALjRzvTbYTS8nDvZ9izGav03adoyS7Y35/v1TPkIYw29"}],"size":4703,"noattachment":false,"key":"/pfork/-/pfork-0.6.2.tgz"},"_npmUser":{"name":"avwu","email":"avenwu@vip.qq.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pfork_0.6.2_1718984980795_0.1594205227421044"},"_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":1718984980943,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1718984980943,"dist-tags":{"latest":"0.6.3"}}