Bytes to human
units_bytes_to_human¶
Format a byte count as a human-readable size string. Uses 1024-based divisions (KiB-style increments) with two decimal places.
Example¶
units_bytes_to_human 2240 # => "2.18 KB"
units_bytes_to_human 1610612736 # => "1.50 GB"
Arguments¶
- $1 (int): Size in bytes
Exit codes¶
- 0: Success; 2 Missing argument
Output on stdout¶
- Human-readable size string, e.g. "2.19 KB", "1.50 GB"