mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-05-16 06:32:00 +00:00
added dl speed translator
This commit is contained in:
parent
e1fb674e86
commit
011f61c0a7
1 changed files with 11 additions and 1 deletions
|
|
@ -281,8 +281,18 @@ class hlsDownload {
|
|||
total: totalSeg
|
||||
})
|
||||
);
|
||||
function formatDLSpeedB(s: number) {
|
||||
if (s < 1000000) return `${(s / 1000).toFixed(2)} KB/s`;
|
||||
if (s < 1000000000) return `${(s / 1000000).toFixed(2)} MB/s`;
|
||||
return `${(s / 1000000000).toFixed(2)} GB/s`;
|
||||
}
|
||||
function formatDLSpeedBit(s: number) {
|
||||
if (s * 8 < 1000000) return `${(s * 8 / 1000).toFixed(2)} KBit/s`;
|
||||
if (s * 8 < 1000000000) return `${(s * 8 / 1000000).toFixed(2)} MBit/s`;
|
||||
return `${(s * 8 / 1000000000).toFixed(2)} GBit/s`;
|
||||
}
|
||||
console.info(
|
||||
`${downloadedSeg} of ${totalSeg} parts downloaded [${data.percent}%] (${Helper.formatTime(parseInt((data.time / 1000).toFixed(0)))} | ${(data.downloadSpeed / 1000000).toFixed(2)} MB/s / ${(data.downloadSpeed * 8 / 1000000).toFixed(2)} Mbit/s)`
|
||||
`${downloadedSeg} of ${totalSeg} parts downloaded [${data.percent}%] (${Helper.formatTime(parseInt((data.time / 1000).toFixed(0)))} | ${formatDLSpeedB(data.downloadSpeed)} / ${formatDLSpeedBit(data.downloadSpeed)})`
|
||||
);
|
||||
if (this.data.callback)
|
||||
this.data.callback({
|
||||
|
|
|
|||
Loading…
Reference in a new issue