优化打包下载
This commit is contained in:
@@ -9,12 +9,12 @@ module.exports = {
|
||||
dbUtils.query(sql).then(res => {
|
||||
let info = res?.[0]
|
||||
if (info?.id) {
|
||||
let path = `${info.target}`, zipPath = `./zips/${info.id}.zip`
|
||||
let path = `${info.target}`, zipPath = `../zips/${info.id}.zip`
|
||||
fse.removeSync(zipPath)
|
||||
fse.pathExists(path, (err, exists) => {
|
||||
console.log(`${path}=========>${exists}`)
|
||||
if (exists) {
|
||||
execute(`zip -r ${zipPath} ${path}`).then(() => {
|
||||
execute(`cd ../zips`).then(() => execute(`zip -r ${info.id}.zip ${path}`)).then(() => {
|
||||
console.log('压缩完成!')
|
||||
setTimeout(() => {
|
||||
response.download(zipPath)
|
||||
|
||||
Reference in New Issue
Block a user