aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/code/package-lock.json11
-rw-r--r--editors/code/package.json2
-rw-r--r--editors/code/src/installation/download_artifact.ts21
3 files changed, 8 insertions, 26 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json
index 0288a468e..6901363fc 100644
--- a/editors/code/package-lock.json
+++ b/editors/code/package-lock.json
@@ -112,12 +112,6 @@
112 "@types/node": "*" 112 "@types/node": "*"
113 } 113 }
114 }, 114 },
115 "@types/throttle-debounce": {
116 "version": "2.1.0",
117 "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz",
118 "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==",
119 "dev": true
120 },
121 "@types/vscode": { 115 "@types/vscode": {
122 "version": "1.42.0", 116 "version": "1.42.0",
123 "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz", 117 "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.42.0.tgz",
@@ -1517,11 +1511,6 @@
1517 "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 1511 "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=",
1518 "dev": true 1512 "dev": true
1519 }, 1513 },
1520 "throttle-debounce": {
1521 "version": "2.1.0",
1522 "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.1.0.tgz",
1523 "integrity": "sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg=="
1524 },
1525 "through": { 1514 "through": {
1526 "version": "2.3.8", 1515 "version": "2.3.8",
1527 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 1516 "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
diff --git a/editors/code/package.json b/editors/code/package.json
index dff535fcd..27e2bbfc3 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -27,7 +27,6 @@
27 "dependencies": { 27 "dependencies": {
28 "jsonc-parser": "^2.1.0", 28 "jsonc-parser": "^2.1.0",
29 "node-fetch": "^2.6.0", 29 "node-fetch": "^2.6.0",
30 "throttle-debounce": "^2.1.0",
31 "vscode-languageclient": "^6.1.1" 30 "vscode-languageclient": "^6.1.1"
32 }, 31 },
33 "devDependencies": { 32 "devDependencies": {
@@ -35,7 +34,6 @@
35 "@rollup/plugin-node-resolve": "^7.1.1", 34 "@rollup/plugin-node-resolve": "^7.1.1",
36 "@types/node": "^12.12.27", 35 "@types/node": "^12.12.27",
37 "@types/node-fetch": "^2.5.4", 36 "@types/node-fetch": "^2.5.4",
38 "@types/throttle-debounce": "^2.1.0",
39 "@types/vscode": "^1.42.0", 37 "@types/vscode": "^1.42.0",
40 "@typescript-eslint/eslint-plugin": "^2.20.0", 38 "@typescript-eslint/eslint-plugin": "^2.20.0",
41 "@typescript-eslint/parser": "^2.20.0", 39 "@typescript-eslint/parser": "^2.20.0",
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
6import { ArtifactReleaseInfo } from "./interfaces"; 6import { ArtifactReleaseInfo } from "./interfaces";
7import { downloadFile } from "./download_file"; 7import { downloadFile } from "./download_file";
8import { 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}