{"name":"pfork","version":"0.2.6","keywords":["child_process","fork","process"],"author":{"name":"avenwu","email":"avenwu@vip.qq.com"},"license":"MIT","_id":"pfork@0.2.6","contributors":[],"homepage":"https://github.com/avwo/pfork","bugs":{"url":"https://github.com/avwo/pfork/issues"},"dist":{"shasum":"28521e2677eb7c6f3eae26269c0baab9169439ce","tarball":"http://registry-npm.ywwl.com/pfork/download/pfork-0.2.6.tgz","fileCount":6,"integrity":"sha512-58okLX8iHvv5WzeOJUCvcMtdfsdg0Okd11j5Hl02x1trZHM1iWfrOdkJdWdXPLUoPK91wgOqKzG8d+gEYvFcWA==","signatures":[{"sig":"MEYCIQCu1iJYHpU6Wa0beQNzIUoTeOu6ToYVbMXSU8NcZR4LUAIhAOPSi5xZ2Br8mP66oe/iPUtIxFR9at5sIyJ7V7gID7Xv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9007,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdExneCRA9TVsSAnZWagAARDgP/jtEw3566pGYVVZbii84\nMMukJBPehHxGK23JrTMHXpF5AhfKMU19bk+To/yeXOaURfKpIGkq4EQq60B5\n9XE24lkq22ZASl10Ip3Emdyk5G4AyxXWeCXbkdTatXpjQiscMnNHt9wrRapK\npJeVOuhNp/ZmaU6069ucgf/Zag1UMCVKU7pYAY1L0v5zZTE7ysb2PjhVc3KE\n3cBOD2Y6zn08treYmRskONpf2RLmEFJ1sbIrFLiEzTa+iDdkld6UBzW2BTKw\nz/Ald1Bn8POkeIAcBLlYCupRiFvB1CbHXmgS0nNHYO0hQA6zV6h7cWY3lI97\n0oai3/mY8+Hnm4tnyucNm8AmOEUlZOYR65OnBq7IemBI12ndU/uG8bePlbwa\nYHctwTGayRu0KpMSvFerEE2Lc9M3o7onG5LBlKgeZEnLHaq6JxXWMa93FPTJ\nTX/Vb615iTZFpAqA+rkah/pSwcsmuqZ004pET97uD9x4iLWIJGH72IqPrRQ9\nVcFMuerQ9ahy56/KxTFAStkaXmCyzzPvLwBadrNFNy7+x3GgpPtzZ6JChGOS\n6O57xy4ULc9YdNQaKrEp7eFQ96c/BgJFIbSwuCjdtV+if6zTJ99phgKuBq/j\nND7ScFpKHjFemOwW1aTQxTwiOvIbvaClAuCcbdtlRNuST2/GMsE6hbMADa2T\nqLFx\r\n=u1tn\r\n-----END PGP SIGNATURE-----\r\n","size":3544,"noattachment":false,"key":"/pfork/-/pfork-0.2.6.tgz"},"main":"lib/index.js","engines":{"node":">= 0.10.0"},"gitHead":"9b79dc04147496e0e688b14e378bd44e3418d7f3","_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.5.1","description":"fork process","directories":{},"_nodeVersion":"8.9.2","dependencies":{"q":"^1.4.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/pfork_0.2.6_1561532893191_0.04389317741147725","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":1561532893308,"maintainers":[{"name":"avwu","email":"avenwu@vip.qq.com"}],"_cnpm_publish_time":1561532893308,"dist-tags":{"latest":"0.6.3"}}