Skip to main content

format_bytes

Function format_bytes 

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

Formats a raw byte count into a human-readable string (e.g. 1048576 -> "1.00 MB"). Supported units: B, KB, MB, GB, TB, PB.

ยงExamples

use rskit_util::bytes::format_bytes;
assert_eq!(format_bytes(1024), "1.00 KB");
assert_eq!(format_bytes(1048576), "1.00 MB");