codecane 1.0.410 → 1.0.411
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/index.js +4 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -171,7 +171,6 @@ async function downloadBinary(version) {
|
|
|
171
171
|
const totalSize = parseInt(res.headers['content-length'] || '0', 10)
|
|
172
172
|
let downloadedSize = 0
|
|
173
173
|
let lastProgressTime = Date.now()
|
|
174
|
-
let lastDownloadedSize = 0
|
|
175
174
|
|
|
176
175
|
const chunks = []
|
|
177
176
|
|
|
@@ -181,25 +180,21 @@ async function downloadBinary(version) {
|
|
|
181
180
|
|
|
182
181
|
const now = Date.now()
|
|
183
182
|
if (now - lastProgressTime >= 100 || downloadedSize === totalSize) {
|
|
184
|
-
const elapsedSeconds = (now - lastProgressTime) / 1000
|
|
185
|
-
const bytesThisInterval = downloadedSize - lastDownloadedSize
|
|
186
|
-
const speed = bytesThisInterval / elapsedSeconds
|
|
187
|
-
|
|
188
183
|
lastProgressTime = now
|
|
189
|
-
lastDownloadedSize = downloadedSize
|
|
190
184
|
|
|
191
185
|
if (totalSize > 0) {
|
|
192
186
|
const percentage = Math.round((downloadedSize / totalSize) * 100)
|
|
193
187
|
const progressBar = createProgressBar(percentage)
|
|
194
|
-
// const sizeInfo = `${formatBytes(downloadedSize)}/${formatBytes(totalSize)}`
|
|
195
|
-
const speedInfo = speed > 0 ? formatSpeed(speed) : ''
|
|
196
188
|
|
|
197
|
-
term.write(
|
|
189
|
+
term.write(
|
|
190
|
+
`Downloading... ${progressBar} ${percentage}% of ${formatBytes(totalSize)}`
|
|
191
|
+
)
|
|
198
192
|
} else {
|
|
199
193
|
term.write(`Downloading... ${formatBytes(downloadedSize)}`)
|
|
200
194
|
}
|
|
201
195
|
}
|
|
202
196
|
}
|
|
197
|
+
term.clearLine()
|
|
203
198
|
console.log('Download complete!')
|
|
204
199
|
|
|
205
200
|
term.write('Extracting...')
|