Skip to main content

format_bytes

Function format_bytes 

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

Format bytes as human-readable size (KB, MB, GB).

ยงExample

use sqlmodel_console::renderables::table_info::format_bytes;

assert_eq!(format_bytes(1024), "1.0 KB");
assert_eq!(format_bytes(1_048_576), "1.0 MB");
assert_eq!(format_bytes(1_073_741_824), "1.0 GB");