Skip to contents

Sizes with the unit that keeps them short, in steps of 1,024: 512 B, 3.4 KB, 12.9 MB and 456 MB, with one decimal under 100. NA is a dash.

Usage

fmt_bytes(x)

Arguments

x

Sizes in bytes.

Value

A character vector.

Examples

rghcard:::fmt_bytes(c(512, 3500, 13.5e6, 4.6e8, NA))
#> [1] "512 B"   "3.4 KB"  "12.9 MB" "439 MB"  "–"