file-size

Crates.iofile-size
lib.rsfile-size
version1.0.3
sourcesrc
created_at2020-08-22 16:04:35.13852
updated_at2020-09-30 06:43:29.705915
descriptiona function formatting file sizes in 4 chars
homepage
repositoryhttps://github.com/Canop/file-size
max_upload_size
id279538
size4,920
Denys Séguret (Canop)

documentation

README

A small function formatting a file size into the nearest ISO representation fitting into 4 characters.

Examples:

use file_size::fit_4;

assert_eq!(&fit_4(999), "999");
assert_eq!(&fit_4(12345), "12K");
assert_eq!(&fit_4(999_999), "1.0M");
assert_eq!(&fit_4(7_155_456_789_012), "7.2T");
Commit count: 4

cargo fmt