pub fn format(bytes: u64) -> String
Expand description
Format bytes to byte string
ยงExamples
assert_eq!(bytefmt::format(123), "123 B");
assert_eq!(bytefmt::format(1_230), "1.23 KB");
assert_eq!(bytefmt::format(1_230_000), "1.23 MB");
assert_eq!(bytefmt::format(1_230_000_000), "1.23 GB");
assert_eq!(bytefmt::format(1_230_000_000_000), "1.23 TB");
assert_eq!(bytefmt::format(1_230_000_000_000_000), "1.23 PB");