Исправление багов

This commit is contained in:
Book Pauk
2022-10-14 21:16:26 +07:00
parent 7799bba9f2
commit ecc7e2b2c3
5 changed files with 48 additions and 18 deletions

View File

@@ -66,8 +66,15 @@ class RemoteLib {
const buf = await this.down.load(`${this.remoteHost}${link}`);
const tmpFile = `${this.config.tempDir}/${utils.randomHexString(30)}`;
const tmpFile2 = `${this.config.tempDir}/${utils.randomHexString(30)}`;
const publicPath = `${this.config.publicDir}${link}`;
await fs.writeFile(publicPath, buf);
await fs.writeFile(tmpFile, buf);
await utils.gzipFile(tmpFile, tmpFile2, 4);
await fs.remove(tmpFile);
await fs.move(tmpFile2, publicPath, {overwrite: true});
return path.basename(link);
} catch (e) {