format_byte_size()
Human-readable byte sizes
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
| Name | Type | Default | Behavior |
|---|---|---|---|
size_bytes | numeric(1) | required | A 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
- new_dvs_bytes(): the
dvs_bytesvector type that uses this formatter. - set_dvs_threads(), dvs_version()