format_bytes

Function format_bytes 

Source
pub fn format_bytes(bytes: usize) -> String
Expand description

Format bytes in human-readable format (B, KB, MB, GB, TB)

ยงExamples

use ipfrs_network::utils::format_bytes;

assert_eq!(format_bytes(1024), "1.00 KB");
assert_eq!(format_bytes(1_048_576), "1.00 MB");
assert_eq!(format_bytes(500), "500 B");