|
@@ -64,17 +64,11 @@ class RemoteLib {
|
|
const response = await await this.wsRequest({action: 'get-book-link', bookPath, downFileName});
|
|
const response = await await this.wsRequest({action: 'get-book-link', bookPath, downFileName});
|
|
const link = response.link;
|
|
const link = response.link;
|
|
|
|
|
|
- const buf = await this.down.load(`${this.remoteHost}${link}`);
|
|
|
|
|
|
+ const buf = await this.down.load(`${this.remoteHost}${link}`, {decompress: false});
|
|
|
|
|
|
- const tmpFile = `${this.config.tempDir}/${utils.randomHexString(30)}`;
|
|
|
|
- const tmpFile2 = `${this.config.tempDir}/${utils.randomHexString(30)}`;
|
|
|
|
const publicPath = `${this.config.publicDir}${link}`;
|
|
const publicPath = `${this.config.publicDir}${link}`;
|
|
|
|
|
|
- await fs.writeFile(tmpFile, buf);
|
|
|
|
-
|
|
|
|
- await utils.gzipFile(tmpFile, tmpFile2, 4);
|
|
|
|
- await fs.remove(tmpFile);
|
|
|
|
- await fs.move(tmpFile2, publicPath, {overwrite: true});
|
|
|
|
|
|
+ await fs.writeFile(publicPath, buf);
|
|
|
|
|
|
return path.basename(link);
|
|
return path.basename(link);
|
|
} catch (e) {
|
|
} catch (e) {
|