feat:modloaer安装
This commit is contained in:
@@ -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,
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user