human-sized 0.2.0

Convert a size in bytes to a human-readable size.
Documentation
  • Coverage
  • 91.3%
    21 out of 23 items documented0 out of 2 items with examples
  • Size
  • Source code size: 9.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.48 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jjpe

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