feat:download update

This commit is contained in:
手瓜一十雪 2024-03-19 11:28:37 +08:00
parent 1d130d4580
commit 63c2b95cbb

View File

@ -1,7 +1,9 @@
import { version } from "../../version";
import https from "node:https";
//import http from "node:http";
import * as path from "node:path";
import * as fs from "node:fs";
import { TEMP_DIR } from ".";
export async function checkVersion() {
const latestVersionText = await getRemoteVersion();
const latestVersion = latestVersionText.split(".");
@ -19,11 +21,11 @@ export async function updateLLOneBot() {
if (latestVersion && latestVersion != "") {
const downloadUrl = "https://github.com/LLOneBot/LLOneBot/releases/download/v" + latestVersion + "/LLOneBot.zip";
const realUrl = mirrorGithubList[0] + downloadUrl;
/**const fileStream = fs.createWriteStream("F:\\TOOLS\\test.zip");
const filePath = path.join(TEMP_DIR, "./update-" + latestVersion + ".zip");
const fileStream = fs.createWriteStream(filePath);
https.get(realUrl, (res) => {
res.pipe(fileStream);
})
*/
}
return false;
}