dotenvx-tui 2.0.1 → 2.0.3
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/install.js +7 -5
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -55,14 +55,16 @@ function downloadFile(url) {
|
|
|
55
55
|
res.on("data", (chunk) => {
|
|
56
56
|
chunks.push(chunk);
|
|
57
57
|
downloaded += chunk.length;
|
|
58
|
+
const mb = (downloaded / 1024 / 1024).toFixed(1);
|
|
58
59
|
if (total > 0) {
|
|
59
60
|
const pct = Math.round((downloaded / total) * 100);
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
process.stderr.write(`\r downloading... ${mb} MB (${pct}%)`);
|
|
62
|
+
} else {
|
|
63
|
+
process.stderr.write(`\r downloading... ${mb} MB`);
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
res.on("end", () => {
|
|
65
|
-
|
|
67
|
+
process.stderr.write("\n");
|
|
66
68
|
resolve(Buffer.concat(chunks));
|
|
67
69
|
});
|
|
68
70
|
res.on("error", reject);
|
|
@@ -91,14 +93,14 @@ async function main() {
|
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
|
|
96
|
+
process.stderr.write(`Downloading ${NAME} v${VERSION} for ${platform}/${arch}...\n`);
|
|
95
97
|
|
|
96
98
|
try {
|
|
97
99
|
const buffer = await downloadFile(url);
|
|
98
100
|
fs.mkdirSync(binDir, { recursive: true });
|
|
99
101
|
extractTarGz(buffer, binDir);
|
|
100
102
|
fs.chmodSync(binPath, 0o755);
|
|
101
|
-
|
|
103
|
+
process.stderr.write(`Installed ${NAME} (${(buffer.length / 1024 / 1024).toFixed(1)} MB)\n`);
|
|
102
104
|
} catch (err) {
|
|
103
105
|
console.error(
|
|
104
106
|
`Failed to download ${NAME}: ${err.message}\n\n` +
|