(bytes)
| 294 | } |
| 295 | |
| 296 | function formatBytes(bytes) { |
| 297 | if (bytes === 0) return '0 B' |
| 298 | const k = 1024 |
| 299 | const sizes = ['B', 'KB', 'MB', 'GB'] |
| 300 | const i = Math.floor(Math.log(bytes) / Math.log(k)) |
| 301 | return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i] |
| 302 | } |
| 303 | |
| 304 | function createProgressBar(percentage, width = 30) { |
| 305 | const filled = Math.round((width * percentage) / 100) |