Skip to main content

parse_bytes

Function parse_bytes 

Source
pub fn parse_bytes(input: &str) -> Result<u64, String>
Expand description

Byte-size parser for values like 4MiB, 512KiB, 100B.

Accepts B, KB/KiB, MB/MiB, GB/GiB (case-insensitive). Binary (KiB) and decimal (KB) suffixes are both treated as binary multiples (1024-based) for simplicity, matching how the rest of the tool talks about file sizes; a bare integer is interpreted as bytes.