aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-03 02:45:00 +0100
committer0neGal <mail@0negal.com>2022-01-03 02:45:00 +0100
commitea8e9ac988561162f8594525ad044cf94f0f1ef4 (patch)
treea5991083219d26e59c9af8fe6079b088c91cf227 /src/utils.js
parentdeeffb821132ca7e0f3309dd566c1f218c8c6332 (diff)
downloadViper-ea8e9ac988561162f8594525ad044cf94f0f1ef4.tar.gz
Viper-ea8e9ac988561162f8594525ad044cf94f0f1ef4.zip
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...
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js7
1 files changed, 7 insertions, 0 deletions
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"));