Crates.io | human-sized |
lib.rs | human-sized |
version | 0.2.0 |
created_at | 2025-05-09 15:34:58.486633+00 |
updated_at | 2025-05-09 15:34:58.486633+00 |
description | Convert a size in bytes to a human-readable size. |
homepage | |
repository | |
max_upload_size | |
id | 1667227 |
size | 9,533 |
A simple library to translate a size in bytes to a either a prefixed size of
either the decimal (e.g. KB
) or binary (e.g. KiB
) varieties.
Add this dependency to your project's Cargo.toml
:
[dependencies]
human-sized = "0.2.0"
We can now get a human-readable representation of the size e.g.
use human_sized::binary;
let hsize = binary(4_400)?;
assert_eq!(hsize, "4 KiB");