aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/net.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/net.ts')
-rw-r--r--editors/code/src/net.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 1ab21e726..3e50d352c 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -99,13 +99,15 @@ export async function download(opts: DownloadOpts) {
99 async (progress, _cancellationToken) => { 99 async (progress, _cancellationToken) => {
100 let lastPercentage = 0; 100 let lastPercentage = 0;
101 await downloadFile(opts.url, tempFile, opts.mode, !!opts.gunzip, (readBytes, totalBytes) => { 101 await downloadFile(opts.url, tempFile, opts.mode, !!opts.gunzip, (readBytes, totalBytes) => {
102 const newPercentage = (readBytes / totalBytes) * 100; 102 const newPercentage = Math.round((readBytes / totalBytes) * 100);
103 progress.report({ 103 if (newPercentage !== lastPercentage) {
104 message: newPercentage.toFixed(0) + "%", 104 progress.report({
105 increment: newPercentage - lastPercentage 105 message: `${newPercentage.toFixed(0)}%`,
106 }); 106 increment: newPercentage - lastPercentage
107 107 });
108 lastPercentage = newPercentage; 108
109 lastPercentage = newPercentage;
110 }
109 }); 111 });
110 } 112 }
111 ); 113 );