{"name":"pfork","version":"0.2.1","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.2.1","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"4e33057dfaf3e38ab9ed89661445a9b1a6d7b55b","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.2.1.tgz","fileCount":7,"integrity":"sha512-Lv/fPMfloApBtkE+v6jx871hEjPcwCj8HGDDXgtVBiThF/rfStopu+nbJUB/cub3/o64SU9BK2Uw1iIQ0OapVg==","signatures":[{"sig":"MEUCIQCgoAaRWfgO6D0XUmaS4tx0qe4OOWR9TWf1HesqJ3v0CQIgPRF8ZvGvHV440r6WUhiNdtnR+FhHU5Bxgcz4pyqPuY4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9400,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcc7FlCRA9TVsSAnZWagAAnvsQAJpnui5UXEU3nbOEqK6q\n7fFf012WgvJFQP+MrmBr9BtCmAczZkjr9FxpelirdiLdxzmyL1SQM1GBGowE\ngMXErH0yIqhuHJ21yzwuRW3fGbMB4vOujcFpx+eI0ff1skwM+Hl4jJyDnbGi\na7swJgm7DzTbwczkFAassvQKtFV+vc/oSoqVFlsmzHyxjjSEn88dACl1miuC\ncPvyHi5zFsFZoyuBcQV03MhQCLdFeIdKMZjPqq1kVVEzqhsZ+l7MKr7nwXH7\nmTLdzoOYrO4W52y6UMSf0TAb6XsdLVz3VitAEVMVpMgnyfcebjYKRPGDNBLh\nfQhCr41NyZfRdZ99tgMdW3xc3F8NEu4PXwQXSCliqc/TbhSCCx8VyOKXLggE\n+OhFsF+V57BUnPRyX7QeJGL76+Kvw8d/A1mjfIDBug8b7Jbf6YZXcVw8Hql8\nqdw0esDQZtWmzjMumTo2MDNIms4SBdZ/VhgXW6YMGeqI7DH+JwVNwQEB3L0/\n74M+KX91fJfKhlB5Oyveexw5qs5dShSMVCpvbM/thTL0Hyus98mjY8VMg1pY\n4vRaGjgwu7U8I8AOqzy6tFRGvsffcgImG2g0zeHTx5n3h5YADqxyNAuAFx2f\ndvPP7N1I67AmqPcd/9oA3agdjU1CBKrs51an7fGYpwdXXtUHmS/6BJBY1a9I\n5uCV\r\n=H0wO\r\n-----END PGP SIGNATURE-----\r\n","size":3877,"noattachment":false,"key":"/pfork/-/pfork-0.2.1.tgz"},"main":"lib/index.js","engines":{"node":">= 0.10.0"},"gitHead":"e6d7337d88529d8dfbf73cd23943a276acfc3a38","_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":"5.0.3","description":"fork process","directories":{},"_nodeVersion":"8.1.4","dependencies":{"q":"^1.4.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/pfork_0.2.1_1551085925208_0.6405216984948043","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":1551085925330,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1551085925330,"dist-tags":{"latest":"0.6.3"}}