DeterministicByteCount

Locale-invariant, deterministic human-readable byte-count formatter. Port of the Swift DeterministicByteCount. Uses Long arithmetic because Kotlin Int is 32-bit and bytes * 10 overflows at GB scale. Decimal (1000-based) units; unit chosen by magnitude, then rounded half-up within it (never re-promoted), so 999_999 -> "1000 KB". Pinned by the wire spec.

Functions

Link copied to clipboard
fun string(bytes: Int): String
fun string(bytes: Long): String