Skip to content

Commit

Permalink
timer
Browse files Browse the repository at this point in the history
  • Loading branch information
maidh91 committed Dec 2, 2024
1 parent 014c3af commit 074e221
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,18 @@ async function download (key, all = false) {
async function monitorDrive (drive) {
const downloadSpeedometer = speedometer()
let downloadedBytes = 0
let speed = 0
const blobs = await drive.getBlobs()
blobs.core.on('download', (_index, bytes) => {
downloadedBytes += bytes
const speed = downloadSpeedometer(bytes)
speed = downloadSpeedometer(bytes)
})
const interval = setInterval(() => {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(`Downloaded: ${byteSize(downloadedBytes)} - Speed: ${byteSize(speed)}/s`);
})
}, 500)
return () => {
clearInterval(interval)
}
}

0 comments on commit 074e221

Please sign in to comment.