Formats a number as Bytes multiplies string.
.toBytesString(digits = 2, locale = 'en-US', overrides = undefined)2).undefined).Note that JavaScript interprets a period in number literals as decimal point. To directly call this function on literal numbers, they need to be enclosed in brackets.
Example with default values:
(1010).toBytesString(); // Result: "0.99 KiB"
Example with specified digits:
(1020001).toBytesString(7); // Result: "0.9727488 MiB"
Examples with locales:
(1010).toBytesString(2, 'de'); // Result: "0,99 KiB" (256543000000).toBytesString(2,'ar'); // Result: "٢٤٠ MiB"
Example with override:
(0).toBytesString(2, 'en', {0: '—'}); // Result: "—" (8).toBytesString(2, 'en', {0: '—'}); // Result: "8 Bytes"