增加自动下载

This commit is contained in:
2025-03-17 11:51:23 +08:00
parent 6c29336660
commit 84f388f294
8 changed files with 91 additions and 10 deletions

View File

@ -105,9 +105,6 @@ async function downloadFromURL(name, url, resolver) {
if (!checkFile(saveName)) {
console.log(`开始下载${name}, 地址:${url}`);
await fetch(url).then(res => {
console.log(res.status)
})
const result = spawnSync("curl", ["-o", saveName + ".cache", "-L", url, "-s", "-w", "%{http_code}"], { ...spawnOption, stdio: "pipe" });
assert(result.status == 0 && result.stdout.toString() == "200", `下载${name}失败`);
fs.renameSync(saveName + ".cache", saveName);