1 unstable release
Uses new Rust 2024
new 0.2.0 | May 9, 2025 |
---|
#169 in Value formatting
86 downloads per month
5KB
75 lines
For more information see the wikipedia
article on byte sizes.
human-readable
Synopsis
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.
Usage
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");