#sized #binary #human-readable #synopsis #human-sized

human-sized

Convert a size in bytes to a human-readable size

1 unstable release

Uses new Rust 2024

new 0.2.0 May 9, 2025

#169 in Value formatting

Download history 86/week @ 2025-05-04

86 downloads per month

Apache-2.0

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");

No runtime deps