From 871202aad16956e1cdc1bc0729d71f594c12aed1 Mon Sep 17 00:00:00 2001 From: smartfrigde <37928912+smartfrigde@users.noreply.github.com> Date: Thu, 30 May 2024 18:52:54 +0200 Subject: [PATCH] fix: modloader downloading --- src/discord/extensions/mods.ts | 4 ++-- src/setup/main.ts | 2 +- src/setup/{preload.ts => preload.mts} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename src/setup/{preload.ts => preload.mts} (100%) diff --git a/src/discord/extensions/mods.ts b/src/discord/extensions/mods.ts index b41ec70..5c8c93a 100644 --- a/src/discord/extensions/mods.ts +++ b/src/discord/extensions/mods.ts @@ -3,8 +3,9 @@ import extract from "extract-zip"; import path from "path"; import {getConfig} from "../../common/config"; import fs from "fs"; +import {promisify} from "node:util"; import {pipeline} from "stream"; -const streamPipeline = pipeline; +const streamPipeline = promisify(pipeline); async function updateModBundle(): Promise { if ((await getConfig("noBundleUpdates")) == undefined ?? false) { try { @@ -108,7 +109,6 @@ export async function installModLoader(): Promise { break; } - await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath)); await extract(zipPath, {dir: path.join(app.getPath("userData"), "plugins")}); diff --git a/src/setup/main.ts b/src/setup/main.ts index de85fde..35d05c6 100644 --- a/src/setup/main.ts +++ b/src/setup/main.ts @@ -17,7 +17,7 @@ export function createSetupWindow(): void { webPreferences: { sandbox: false, spellcheck: false, - preload: path.join(import.meta.dirname, "preload.js") + preload: path.join(import.meta.dirname, "preload.mjs") } }); ipcMain.on("saveSettings", (_event, args: Settings) => { diff --git a/src/setup/preload.ts b/src/setup/preload.mts similarity index 100% rename from src/setup/preload.ts rename to src/setup/preload.mts