(size: number)
| 87 | let displaySize = size; |
| 88 | while (displaySize >= 1024 && level < UNITS.length - 1) { |
| 89 | displaySize /= 1024; |
| 90 | level++; |
| 91 | } |
| 92 | return `${displaySize.toFixed(2)} ${UNITS[level]}`; |
| 93 | } |
| 94 | |
| 95 | // 格式化剩余秒数 |
| 96 | function formatTimeRemaining(seconds: number): string { |
| 97 | seconds = Math.max(0, Math.floor(seconds)); |
| 98 | const days = Math.floor(seconds / 86400); |
| 99 | const hours = Math.floor((seconds % 86400) / 3600); |
| 100 | const minutes = Math.floor((seconds % 3600) / 60); |
| 101 | const secs = Math.floor(seconds % 60); |
| 102 | return `${days.toString().padStart(2, '0')}天${hours.toString().padStart(2, '0')}小时${minutes.toString().padStart(2, '0')}分${secs.toString().padStart(2, '0')}秒`; |
no outgoing calls
no test coverage detected