(bytes: number)
| 12 | } |
| 13 | |
| 14 | export function formatFileSize(bytes: number): string { |
| 15 | let value = bytes; |
| 16 | let unitIndex = 0; |
| 17 | |
| 18 | while (value >= 1024 && unitIndex < FILE_SIZE_UNITS.length - 1) { |
| 19 | value /= 1024; |
| 20 | unitIndex += 1; |
| 21 | } |
| 22 | |
| 23 | if (unitIndex === 0) { |
| 24 | return `${Math.round(value)} ${FILE_SIZE_UNITS[unitIndex]}`; |
| 25 | } |
| 26 | |
| 27 | const rounded = Math.round(value * 100) / 100; |
| 28 | return `${rounded} ${FILE_SIZE_UNITS[unitIndex]}`; |
| 29 | } |
| 30 | |
| 31 | export function remainingEditableAttachments( |
| 32 | originalAttachments: readonly AttachmentBlock[], |
no outgoing calls
no test coverage detected