format_byte_size() formats a byte count as a human-readable size string. It is the same formatter used to print the size columns returned by dvs_add(), dvs_status(), and dvs_get().

format_byte_size(size_bytes)

🔗Parameters

NameTypeDefaultBehavior
size_bytesnumeric(1)requiredA single non-negative byte count.

🔗Usage

options(width = 1000)
library(dvs)
sapply(c(0, 512, 2048, 5e6, 3e9), format_byte_size)
[1] "0 B"    "512 B"  "2.0 KB" "4.8 MB" "2.8 GB"

🔗See also