Expand description
Display formatting for download rates and durations.
Shared by every Rust renderer (the CLI progress bars in gglib-download)
and mirrored exactly by formatRate / formatDuration in
src/utils/format.ts so the CLI, the Tauri GUI and the web UI all render the
same number the same way.
ยงUnits
Rates are decimal โ 1 MB/s is 1,000,000 bytes per second. This matches
Activity Monitor, nettop, iftop and every ISP, which is what users
compare a download speed against.
Sizes stay binary (MiB, GiB) because that is the convention for
model files on disk, and are rendered by indicatifโs HumanBytes, which
already labels them correctly. Do not use this module for sizes.
Constantsยง
Functionsยง
- format_
duration - Format a duration in seconds as
45s,3m 20sor1h 04m. - format_
rate - Format a transfer rate in decimal units, e.g.
118.4 MB/s.