diff options
Diffstat (limited to 'editors/code/src/installation')
-rw-r--r-- | editors/code/src/installation/download_artifact.ts | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/editors/code/src/installation/download_artifact.ts b/editors/code/src/installation/download_artifact.ts index 356723aba..8ed99bf0a 100644 --- a/editors/code/src/installation/download_artifact.ts +++ b/editors/code/src/installation/download_artifact.ts | |||
@@ -5,7 +5,6 @@ import { strict as assert } from "assert"; | |||
5 | 5 | ||
6 | import { ArtifactReleaseInfo } from "./interfaces"; | 6 | import { ArtifactReleaseInfo } from "./interfaces"; |
7 | import { downloadFile } from "./download_file"; | 7 | import { downloadFile } from "./download_file"; |
8 | import { throttle } from "throttle-debounce"; | ||
9 | 8 | ||
10 | /** | 9 | /** |
11 | * Downloads artifact from given `downloadUrl`. | 10 | * Downloads artifact from given `downloadUrl`. |
@@ -38,19 +37,15 @@ export async function downloadArtifact( | |||
38 | async (progress, _cancellationToken) => { | 37 | async (progress, _cancellationToken) => { |
39 | let lastPrecentage = 0; | 38 | let lastPrecentage = 0; |
40 | const filePermissions = 0o755; // (rwx, r_x, r_x) | 39 | const filePermissions = 0o755; // (rwx, r_x, r_x) |
41 | await downloadFile(downloadUrl, installationPath, filePermissions, throttle( | 40 | await downloadFile(downloadUrl, installationPath, filePermissions, (readBytes, totalBytes) => { |
42 | 200, | 41 | const newPercentage = (readBytes / totalBytes) * 100; |
43 | /* noTrailing: */ true, | 42 | progress.report({ |
44 | (readBytes, totalBytes) => { | 43 | message: newPercentage.toFixed(0) + "%", |
45 | const newPercentage = (readBytes / totalBytes) * 100; | 44 | increment: newPercentage - lastPrecentage |
46 | progress.report({ | 45 | }); |
47 | message: newPercentage.toFixed(0) + "%", | ||
48 | increment: newPercentage - lastPrecentage | ||
49 | }); | ||
50 | 46 | ||
51 | lastPrecentage = newPercentage; | 47 | lastPrecentage = newPercentage; |
52 | }) | 48 | }); |
53 | ); | ||
54 | } | 49 | } |
55 | ); | 50 | ); |
56 | } | 51 | } |