{"name":"pfork","version":"0.5.0","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.5.0","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"3bdb634c9e230e9f3764532d1dbb4652135607ef","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.5.0.tgz","fileCount":7,"integrity":"sha512-za0KS9D98IppjLZpxzG1ZOssB3OD4g4fpC3e6wK2Yp8CxX7KJqhP4VczeiY/7aj0QvuUUlwSecLBJgcDyhZopQ==","signatures":[{"sig":"MEYCIQDZZVBmmkJcfTmQEUU3ag6DGCU1YvrZvO/56o1Ho91RGAIhAPx+q7NVX+7yVdu3JWDIUtXMmICIzirlSUaFwBALfVTc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12954,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9R2NCRA9TVsSAnZWagAA6s0P/R9fDt6z/w+5rS298xOJ\nFV2vgG2ed7dXtFyMCjG31m1Js+rgIplO2DWh3VeqpPtuOddgvWWfTDBO4zs4\n1JM4dQDPIQBumxMb+iI2kSGewBoM6PYP8IfZgtVLjfdgluyhJDaTZ09fu2MC\n1g3RyqPVT5/7PKrs6DWge1UJiUK9kCHHlRQiKWgJdkpHuuaeeume5f0e4BEk\nMTjmEhbrxgeJfldV0nJHH2CHetxwmylZaeuAhB8ssdlVCQh2PwSCWAHR5ayG\nA926LyJ8bzJz5jYc+WKl5AZimokt1aWmPxxPYY7UHWJCp6R8V57raBYdp8Q1\nFiZMMif+wjPDpOTsJqYEwQrHrNEtXsnabP669Ax89PHJqDe7CHsk8EUyH5V4\nnG5AyNqr+k2PgesipJ8HPiV/so4hzzxCPYqtJ/qmXEvuoVXN++PmeI52lxd0\ngpM24OTlHQ1dI6I5HbeAJbf8yYLObStFuxoxBx5cmMcNuzlSUOYGEG6UnJ4l\nDEEqqv9OH87BSh/U84jV3dt1f8L7w0sO9r8MHKQpmj3hraykAFRxwHWx6aY7\n0+BzY93BKlB49MsfWhBjrQPWvPVvjmN4GM/wUxCYhA8rItRoN+0e+pbAI+tR\nK+OTY9cQ0Xd0+0/HzvfOCaUKxdgveEBWZ/Z94hwKAm3KGbvT9cqzxARrnsgI\nvF5S\r\n=UVgq\r\n-----END PGP SIGNATURE-----\r\n","size":4542,"noattachment":false,"key":"/pfork/-/pfork-0.5.0.tgz"},"main":"lib/index.js","engines":{"node":">= 0.10.0"},"gitHead":"99493d2b16ba8529762086135141aab695bccd56","scripts":{"lint":"eslint ./lib index.js","lintfix":"eslint --fix ./lib index.js"},"_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":"6.14.8","description":"fork process","directories":{},"_nodeVersion":"14.15.1","dependencies":{"q":"^1.4.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^2.13.1"},"_npmOperationalInternal":{"tmp":"tmp/pfork_0.5.0_1609899404848_0.5786659623717878","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":1609899404997,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1609899404997,"dist-tags":{"latest":"0.6.3"}}