fix:unzip error

This commit is contained in:
Tianpao
2025-07-09 10:20:20 +08:00
parent f0ead136fe
commit f2fa0c8bdf
7 changed files with 68 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import pMap from "p-map";
import pRetry from "p-retry";
import fs from "node:fs"
import fse from "fs-extra"
import yauzl from "yauzl";
import got from "got";
@@ -35,7 +36,7 @@ export async function fastdownload(data:[string,string]){
const bar = multibar.create(size, 0, {filename: e[1]})
try{
await pRetry(async()=>{
if(!fse.existsSync(e[1])){
if(!fs.existsSync(e[1])){
await got.get(e[0],{
responseType:"buffer",
}).on('downloadProgress',(progress)=>{
@@ -105,7 +106,7 @@ export async function xfastdownload(
url !== null &&
url !== "" &&
path !== null &&
!fse.existsSync(e[1])
!fs.existsSync(e[1])
) {
const res = (await got.get(e[0])).rawBody; //下载文件
await fse.outputFile(e[1], res); //保存文件