mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-11-27 06:59:54 +08:00
测试 目录压缩功能
This commit is contained in:
parent
fb6b348b68
commit
1ebb301a01
@ -61,13 +61,18 @@ if (realArgv.length >= 1) {
|
||||
// zipped.compress(); // compress before exporting
|
||||
// var buff = zipped.memory(); // get the zipped file as a Buffer
|
||||
// // or save the zipped file to disk
|
||||
// zipped.save('压缩文件_' + realArgv[1] + '.zip', function (error) {
|
||||
// zipped.save(compressZipPath, function (error) {
|
||||
// if (!error) { }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// 同步写法,我们使用同步写法,因为这是子进程
|
||||
zipper.sync.zip(realArgv[1]).compress().save('压缩文件_' + realArgv[1] + '.zip');
|
||||
const absPath = realArgv[1];
|
||||
const compressZipPath = path.normalize(
|
||||
path.dirname(absPath) + '/压缩文件_' + path.basename(absPath, path.extname(absPath)) + '.zip'
|
||||
);
|
||||
console.log('压缩到:' + compressZipPath)
|
||||
zipper.sync.zip(absPath).compress().save(compressZipPath);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
|
34
package-lock.json
generated
34
package-lock.json
generated
@ -31,6 +31,11 @@
|
||||
"resolved": "http://registry.npm.taobao.org/array-flatten/download/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"async": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npm.taobao.org/async/download/async-1.5.2.tgz?cache=0&sync_timestamp=1563385399810&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync%2Fdownload%2Fasync-1.5.2.tgz",
|
||||
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.1.tgz",
|
||||
@ -404,6 +409,14 @@
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"jszip": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npm.taobao.org/jszip/download/jszip-2.6.1.tgz",
|
||||
"integrity": "sha1-uI86ey5noqBIFSmCx6N1bZxIKPA=",
|
||||
"requires": {
|
||||
"pako": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"long-timeout": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/long-timeout/-/long-timeout-0.1.1.tgz",
|
||||
@ -506,6 +519,11 @@
|
||||
"resolved": "http://registry.npm.taobao.org/os-utils/download/os-utils-0.0.14.tgz",
|
||||
"integrity": "sha1-KeURaXsZgrjGJ3Ihdf45eX72QVY="
|
||||
},
|
||||
"pako": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npm.taobao.org/pako/download/pako-1.0.10.tgz",
|
||||
"integrity": "sha1-Qyi621CGpCaqkPVBl31JVdpclzI="
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "http://registry.npm.taobao.org/parseurl/download/parseurl-1.3.2.tgz",
|
||||
@ -540,6 +558,11 @@
|
||||
"ipaddr.js": "1.5.2"
|
||||
}
|
||||
},
|
||||
"q": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz",
|
||||
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.5.1",
|
||||
"resolved": "http://registry.npm.taobao.org/qs/download/qs-6.5.1.tgz",
|
||||
@ -690,6 +713,17 @@
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"zip-local": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npm.taobao.org/zip-local/download/zip-local-0.3.4.tgz",
|
||||
"integrity": "sha1-4pMZByV6lGR56lvQ0OIK3+srWgc=",
|
||||
"requires": {
|
||||
"async": "^1.4.2",
|
||||
"graceful-fs": "^4.1.3",
|
||||
"jszip": "^2.5.0",
|
||||
"q": "^1.4.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,8 @@
|
||||
"os-utils": "0.0.14",
|
||||
"pidusage": "^1.1.5",
|
||||
"properties": "^1.2.1",
|
||||
"uuid": "^3.2.1"
|
||||
"uuid": "^3.2.1",
|
||||
"zip-local": "^0.3.4"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"repository": {
|
||||
|
@ -11,14 +11,14 @@
|
||||
<title>文件在线管理 | Mcserver Manager</title>
|
||||
<link rel=stylesheet href=static/bootstrap/css/bootstrap.min.css> <link rel=stylesheet href=static/main.css> <link
|
||||
href=favicon.ico rel="shortcut icon">
|
||||
<link href=css/app.a55e53b5.css rel=preload as=style>
|
||||
<link href=js/app.69b465be.js rel=preload as=script>
|
||||
<link href=js/chunk-vendors.40357f11.js rel=preload as=script>
|
||||
<link href=css/app.a55e53b5.css rel=stylesheet>
|
||||
<link href=css/app.css rel=preload as=style>
|
||||
<link href=js/app.js rel=preload as=script>
|
||||
<link href=js/chunk-vendors.js rel=preload as=script>
|
||||
<link href=css/app.css rel=stylesheet>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id=app></div>
|
||||
<script src=../common/URL.js> </script> <script src=static/es6-promise.auto.min.js> </script> <script
|
||||
src=static/jquery-3.2.1.min.js> </script> <script src=js/chunk-vendors.40357f11.js> </script> <script
|
||||
src=js/app.69b465be.js> </script> </body> </html>
|
||||
src=static/jquery-3.2.1.min.js> </script> <script src=js/chunk-vendors.js> </script> <script src=js/app.js>
|
||||
</script> </body> </html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/onlinefs_public/js/app.js
Normal file
2
public/onlinefs_public/js/app.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -126,6 +126,13 @@ export default {
|
||||
case "使用提示":
|
||||
functionMudule.userInfo();
|
||||
break;
|
||||
case "压缩目录":
|
||||
if (this.getFileStack().length != 1) {
|
||||
tools.popWindow("不可解压空文件或同时解压多个文件!", "非法操作");
|
||||
break;
|
||||
}
|
||||
functionMudule.compress(this.getFileStack()).then(() => {});
|
||||
break;
|
||||
case "解压 ZIP":
|
||||
if (this.getFileStack().length != 1) {
|
||||
tools.popWindow("不可解压空文件或同时解压多个文件!", "非法操作");
|
||||
@ -191,6 +198,11 @@ export default {
|
||||
class: "glyphicon glyphicon-pencil",
|
||||
api: ""
|
||||
},
|
||||
{
|
||||
name: "压缩目录",
|
||||
class: "glyphicon glyphicon-level-up",
|
||||
api: ""
|
||||
},
|
||||
{
|
||||
name: "解压 ZIP",
|
||||
class: "glyphicon glyphicon-level-up",
|
||||
|
@ -167,6 +167,11 @@ export default {
|
||||
return promiseAjax(MCSERVER.URL("fs/extract"), filesStack[0].name);
|
||||
},
|
||||
|
||||
//压缩文件
|
||||
compress: (filesStack) => {
|
||||
return promiseAjax(MCSERVER.URL("fs/compress"), filesStack[0].name);
|
||||
},
|
||||
|
||||
//编辑文件
|
||||
editFile: (filesStack) => {
|
||||
const filename = filesStack[0].name;
|
||||
|
Loading…
Reference in New Issue
Block a user