feat:modloaer安装

This commit is contained in:
Tianpao
2025-07-02 21:32:24 +08:00
parent ea56258dee
commit 38c0aeb516
4 changed files with 257 additions and 1 deletions

View File

@@ -82,4 +82,41 @@ export async function mr_fastdownload(data:[string,string,string]){
multibar.remove(bar);
}
}, { concurrency: 16 });
}
}
export async function xfastdownload(
url: string,
path: string,
concurrency: number = 1
) {
let e = [];
e.push([url, path]);
await pMap(
e,
async (e) => {
try {
return await pRetry(
async () => {
if (
url !== null &&
url !== "" &&
path !== null &&
!fse.existsSync(e[1])
) {
const res = (await got.get(e[0])).rawBody; //下载文件
await fse.outputFile(e[1], res); //保存文件
}
},
{
retries: 2,
}
);
} catch (error) {
LOGGER.error({ err: error });
}
},
{
concurrency: concurrency,
}
);
}