Skip to main content

Module bytes

Module bytes 

Source
Expand description

Formatting and parsing human-readable data sizes.

Functionsยง

format_bytes
Formats a raw byte count into a human-readable string (e.g. 1048576 -> "1.00 MB"). Supported units: B, KB, MB, GB, TB, PB.
parse_bytes
Parses human-readable sizes (e.g. "5MB", "10KB", "2GB") into a raw byte count (u64). Case-insensitive, supports optional space, and treats unit-less values as bytes.