(bytes: number)
| 102 | |
| 103 | // Detect best bytes unit from value |
| 104 | function detectBytesUnit(bytes: number): number { |
| 105 | const tib = 1024 * 1024 * 1024 * 1024; |
| 106 | const gib = 1024 * 1024 * 1024; |
| 107 | const mib = 1024 * 1024; |
| 108 | // Use magnitude-based detection so fractional values like "24.5 TiB" re-open as TiB, |
| 109 | // rather than being reduced to "GiB" due to exact divisibility. |
| 110 | if (bytes >= tib) return tib; |
| 111 | if (bytes >= gib) return gib; |
| 112 | return mib; |
| 113 | } |
| 114 | |
| 115 | interface LeafConditionProps { |
| 116 | id: string; |