* Format the total bytes as a human-readable string.
(totalBytes)
| 4654 | * Format the total bytes as a human-readable string. |
| 4655 | */ |
| 4656 | function formatSize(totalBytes) { |
| 4657 | if (!Number.isFinite(totalBytes) || totalBytes < 0) return ""; |
| 4658 | |
| 4659 | if (totalBytes < 1024) { |
| 4660 | return totalBytes + " B"; |
| 4661 | } else if (totalBytes < 1024 * 1024) { |
| 4662 | return (totalBytes / 1024).toFixed(1) + " KB"; |
| 4663 | } else if (totalBytes < 1024 * 1024 * 1024) { |
| 4664 | return (totalBytes / (1024 * 1024)).toFixed(1) + " MB"; |
| 4665 | } else { |
| 4666 | return (totalBytes / (1024 * 1024 * 1024)).toFixed(1) + " GB"; |
| 4667 | } |
| 4668 | } |
| 4669 | |
| 4670 | |
| 4671 | function ensureNonZipDownloadPanel() { |
no outgoing calls
no test coverage detected