Bytes
The Bytes component formats raw byte counts into human-readable file sizes (KB / MB / GB / TB). Supports both binary (1024) and decimal (1000) unit bases.
Basic Usage
Pass a byte value via the value prop. The component automatically selects the appropriate unit.
vue
<TBytes :value="128" />
<TBytes :value="2456000" />
<TBytes :value="1520000000" />Decimal Places
Control decimal places via the decimals prop. Default is 1.
vue
<TBytes :value="1520000000" :decimals="0" />
<TBytes :value="1520000000" :decimals="2" />Base Switching
Set :base="1000" for decimal units (commonly used by hard drive manufacturers). Default is 1024 (binary).
vue
<TBytes :value="1520000000" :base="1024" />
<TBytes :value="1520000000" :base="1000" />IEC Units
Set iec to use KiB / MiB / GiB (IEC standard units, only effective with base=1024).
vue
<TBytes :value="1520000000" :base="1024" iec />API
Props
| Prop | Description | Type | Default |
|---|---|---|---|
value | Byte count | number | — (required) |
decimals | Number of decimal places | number | 1 |
separator | Separator between value and unit | string | ' ' |
base | Unit base (1024 binary / 1000 decimal) | number | 1024 |
iec | Use IEC standard units (KiB/MiB) | boolean | false |