From 63c2b95cbba2f8bee09ea1d02f6063f4f63057c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Tue, 19 Mar 2024 11:28:37 +0800 Subject: [PATCH] feat:download update --- src/common/utils/update.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/utils/update.ts b/src/common/utils/update.ts index 13a3f77..e29e17c 100644 --- a/src/common/utils/update.ts +++ b/src/common/utils/update.ts @@ -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; }