From ea8e9ac988561162f8594525ad044cf94f0f1ef4 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Mon, 3 Jan 2022 02:45:00 +0100 Subject: download progress for NS However in megabytes, and I don't know math very well, I just know (bytes / 1024 / 1024) gives megabytes, if you know a better simpler way to convert this make a PR, please... --- src/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/utils.js b/src/utils.js index 9e6154a..e378366 100644 --- a/src/utils.js +++ b/src/utils.js @@ -100,6 +100,13 @@ function update() { https.get(body.assets[0].browser_download_url, (res) => { let stream = fs.createWriteStream(settings.zip); res.pipe(stream); + + let received = 0; + res.on("data", (chunk) => { + received += chunk.length; + winLog(lang("gui.update.downloading") + " " + (received / 1024 / 1024).toFixed(1) + "mb"); + }) + stream.on("finish", () => { stream.close(); winLog(lang("gui.update.extracting")); -- cgit v1.2.3