forked from mirror/MCSM-Daemon
Feat: 完善部分内容
This commit is contained in:
parent
9af87e5668
commit
aadfee16ed
@ -44,6 +44,7 @@ function archiveZip(zipPath: string, files: string[], fileCode: string = "utf-8"
|
||||
const output = fs.createWriteStream(zipPath);
|
||||
const archive = archiver("zip", {
|
||||
zlib: { level: 9 }
|
||||
// encoding: fileCode
|
||||
});
|
||||
files.forEach((v) => {
|
||||
const basename = path.normalize(path.basename(v));
|
||||
@ -58,9 +59,7 @@ function archiveZip(zipPath: string, files: string[], fileCode: string = "utf-8"
|
||||
resolve(true);
|
||||
});
|
||||
archive.on("warning", function (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
reject(err);
|
||||
}
|
||||
reject(err);
|
||||
});
|
||||
archive.on("error", function (err) {
|
||||
reject(err);
|
||||
@ -75,8 +74,7 @@ function archiveUnZip(sourceZip: string, destDir: string, fileCode: string = "ut
|
||||
const zip = new StreamZip.async({ file: sourceZip, nameEncoding: fileCode });
|
||||
if (!fs.existsSync(destDir)) fs.mkdirsSync(destDir);
|
||||
try {
|
||||
const count = await zip.extract(null, destDir);
|
||||
console.log(`Extracted ${count} entries`);
|
||||
await zip.extract(null, destDir);
|
||||
return resolve(true);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
|
@ -31,11 +31,11 @@ function builderPassword() {
|
||||
|
||||
// @Entity
|
||||
class Config {
|
||||
public version = 1;
|
||||
public version = 2;
|
||||
public ip = "";
|
||||
public port = 24444;
|
||||
public key = builderPassword();
|
||||
public maxFileTask = 3;
|
||||
public maxFileTask = 2;
|
||||
}
|
||||
|
||||
// 守护进程配置类
|
||||
|
Loading…
Reference in New Issue
Block a user