Takes an integer (referring to number of bytes) and returns an optimally human-readable binary-prefixed byte size (KiB, MiB, GiB, TiB, PiB, EiB). The function is vectorised.
human_filesize(x)
A positive integer, i.e. the number of bytes (B). Can be a vector of file sizes.
A character vector.
human_filesize(7845691)
#> [1] "7.5 MiB"
v <- c(12345, 456987745621258)
human_filesize(v)
#> [1] "12.1 KiB" "415.6 TiB"