Import std.text.humanize
FormatBytes
function
Public Function FormatBytes(count: Int64, binary: Bool = False): String
count bytes as people say them, in the largest unit they make at least 1 of, to a tenth,
rounded half up: "1.2 MB", "999 B", and "-3.4 GB". The units are 1000 apart, or with binary,
1024: "1.2 MiB".
Examples
Expect(FormatBytes(999) == "999 B")
Expect(FormatBytes(1_234_567) == "1.2 MB")
Expect(FormatBytes(1536, True) == "1.5 KiB")Report an issue with this page or with FutureBlitz on GitHub.