Formats a byte count as a human-readable string with an appropriate unit.
Number of bytes.
Number of decimal places. Defaults to 2.
2
formatBytes(0) // => "0 B"formatBytes(1024) // => "1.00 KB"formatBytes(1048576, 1) // => "1.0 MB" Copy
formatBytes(0) // => "0 B"formatBytes(1024) // => "1.00 KB"formatBytes(1048576, 1) // => "1.0 MB"
Formats a byte count as a human-readable string with an appropriate unit.