human-sized

Crates.iohuman-sized
lib.rshuman-sized
version0.2.0
created_at2025-05-09 15:34:58.486633+00
updated_at2025-05-09 15:34:58.486633+00
descriptionConvert a size in bytes to a human-readable size.
homepage
repository
max_upload_size
id1667227
size9,533
(jjpe)

documentation

README

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");
Commit count: 0

cargo fmt