dotenvx-tui 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +0 -0
- package/install.js +15 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
File without changes
|
package/install.js
CHANGED
|
@@ -49,9 +49,22 @@ function downloadFile(url) {
|
|
|
49
49
|
if (res.statusCode !== 200) {
|
|
50
50
|
return reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
51
51
|
}
|
|
52
|
+
const total = parseInt(res.headers["content-length"] || "0", 10);
|
|
52
53
|
const chunks = [];
|
|
53
|
-
|
|
54
|
-
res.on("
|
|
54
|
+
let downloaded = 0;
|
|
55
|
+
res.on("data", (chunk) => {
|
|
56
|
+
chunks.push(chunk);
|
|
57
|
+
downloaded += chunk.length;
|
|
58
|
+
if (total > 0) {
|
|
59
|
+
const pct = Math.round((downloaded / total) * 100);
|
|
60
|
+
const mb = (downloaded / 1024 / 1024).toFixed(1);
|
|
61
|
+
process.stdout.write(`\r downloading... ${mb} MB (${pct}%)`);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
res.on("end", () => {
|
|
65
|
+
if (total > 0) process.stdout.write("\n");
|
|
66
|
+
resolve(Buffer.concat(chunks));
|
|
67
|
+
});
|
|
55
68
|
res.on("error", reject);
|
|
56
69
|
})
|
|
57
70
|
.on("error", reject);
|