(size: number, unit: string)
| 64 | |
| 65 | // Helper function to format the byte length into a string |
| 66 | const formatSize = (size: number, unit: string) => { |
| 67 | const formattedSize = size.toFixed(2) |
| 68 | // Remove unnecessary '.00' |
| 69 | if (formattedSize.endsWith('.00')) { |
| 70 | return `${parseInt(formattedSize, 10)} ${unit}` |
| 71 | } |
| 72 | return `${formattedSize} ${unit}` |
| 73 | } |
| 74 | |
| 75 | // Convert and format byte length to appropriate unit |
| 76 | if (inputByteLength < 0.1 * KB) { |