diff --git a/src/rest/autodeploy/download.js b/src/rest/autodeploy/download.js index b732e76..e83f177 100644 --- a/src/rest/autodeploy/download.js +++ b/src/rest/autodeploy/download.js @@ -1,7 +1,6 @@ const dbUtils = require("../../utils/dbUitls"); -const archiver = require("archiver") const fse = require("fs-extra"); -const fs = require("fs"); +const execute = require("../../tools/exec"); module.exports = { action: "/node/autodeploy/download", method: "post", @@ -15,14 +14,7 @@ module.exports = { fse.pathExists(path, (err, exists) => { console.log(`${path}=========>${exists}`) if (exists) { - let output = fs.createWriteStream(zipPath), - arc = archiver('zip') - arc.on('error', err => { - response.send({code: 1, err}) - }) - arc.pipe(output) - arc.directory(path, false) - arc.finalize().then(() => { + execute(`zip -r ${zipPath} ${path}`).then(() => { console.log('压缩完成!') setTimeout(() => { response.download(zipPath)