Crates.io | file-size |
lib.rs | file-size |
version | 1.0.3 |
source | src |
created_at | 2020-08-22 16:04:35.13852 |
updated_at | 2020-09-30 06:43:29.705915 |
description | a function formatting file sizes in 4 chars |
homepage | |
repository | https://github.com/Canop/file-size |
max_upload_size | |
id | 279538 |
size | 4,920 |
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");