{"name":"pfork","version":"0.4.0","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.4.0","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"cf5faaff5d22c647d298f828c78df0d2218503de","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.4.0.tgz","fileCount":7,"integrity":"sha512-6m1ZFW0XLXmeNvOvIxlOMqpI/5XlbZDqCnmJzrC6hiebJ584k57En4B+QiC5EoXT8+8jsLAVoxmpiiZfjv+4fQ==","signatures":[{"sig":"MEUCIQDQGy0MrWAQn6ovljW8H/fYtl5yM4YhdxdsCI18Zeqm3AIgHQQyj0ks/4CzpYkfni5mi6ohht3D+C74tD2ARVRkLxI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11884,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf9GTKCRA9TVsSAnZWagAAxOQP/1j01TrS+1jKk7kZm+zi\n9Rbtbq27caEFJ/qHheGTtK+GiBuUYtL9AtmtsgaUZRM8LlO/oTeHdXhZN1JO\neP2WLZ29gqmH1g6UzqA/bVUAmu2s47TzGa30El5PgbHKKWONWsvgNwVUX+Cs\nKajuWy9tNwbsppn7MI9qMwJwY+ETgdNqwDOmYf5wmRa557odLwLIX9e9axUn\ndWb+/g0V+ftl6s/S2AkQKXcSceXFg8g3KwiHVPYBqoeQzDistZbdY2kUlPPa\n4jI8bnH7yz3qjumMamfUXLQpDYUggdK4bGZI7XMrRWzQ3GoGs0vGX5+9OGcb\nOngYootKkhPDqYAQBfHUerscqLfF5vG0qsZPo/Yidgi9E8iz43RZoLsRJF8C\nytEX97d0mm6JuGHbb4WDqQlEID+mx79k/Ln5M23nz8+oHfLnK+83hBGrnrt8\nZMedWzeu0I7L8/cMGXsTiz33ssoa/olzzeV6Ba51a2zGEv5L5PlaU/YnnWkr\nWShvDkT3jtdi2fnesJEeJnQgtiVSRV3JlhteHeqn/vT6Y/ctJgUitHzn6GZP\nPz5rhZqNmUWEkWg5ixWun24N6iBso6F+/FOOreY3RsnQHrwoa82W0pry660h\naaXb3JgflRKz2Ku33B8iqU0bNzpDVR3BR3JRS1z9h2xDrdLfE4/RQZ4boEfD\nKlOA\r\n=V0uL\r\n-----END PGP SIGNATURE-----\r\n","size":4291,"noattachment":false,"key":"/pfork/-/pfork-0.4.0.tgz"},"main":"lib/index.js","engines":{"node":">= 0.10.0"},"gitHead":"0cc9e40694b982ca2c4d85d8f7bfa4ac76bc1d4e","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.4.0_1609852106422_0.22830482419060494","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":1609852106553,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1609852106553,"dist-tags":{"latest":"0.6.3"}}