Format Bytes

Formats a byte (or bit) value into a human-readable, locale-aware string, auto-scaling to the best unit.

Examples

500 →
1024 →
1500000 →
3221225472 →
1099511627776 →
format-bytes.html
html
1 <nana-format-bytes value="1024"></nana-format-bytes>
2 <nana-format-bytes value="1500000" unit="bit"></nana-format-bytes>

Import

main.ts
ts
1 import "@nana-tec/ui-components/format-bytes";

Props

AttributeTypeDefault
valuenumber0
unitbyte | bitbyte
displaylong | short | narrowshort
localestring