X Enterprises
Fmt

FmtFileSize

Converts byte counts to human-readable file size strings (KB, MB, GB, etc.).

Fmt

The Fmt category provides stateless display formatters. Each component is a thin wrapper around native Intl APIs, VueUse, or Nuxt utilities — they accept a raw value and render formatted output without any side effects.

Components

<XAFmtFileSize />

Converts a byte count to a human-readable string. Supports decimal (KB, MB, GB) or binary (KiB, MiB, GiB) unit systems.

<XAFmtFileSize :value="document.size" />
<!-- Output: 2.38 MB -->

<XAFmtFileSize :value="1073741824" :binary="true" :decimals="0" />
<!-- Output: 1 GiB -->

Props

PropTypeDefaultDescription
valueNumberrequiredFile size in bytes
decimalsNumber2Decimal places
binaryBooleanfalseUse binary units (KiB, MiB, GiB)
localeString'en-US'BCP 47 locale for number formatting
fallbackString'0 B'Text shown for zero or null values
textClassString''Additional CSS classes

AI Context

component: XAFmtFileSize
package: "@xenterprises/nuxt-x-app"
auto-import: true
prefix: XA
category: Fmt
use-when: Displaying raw byte counts as human-readable file sizes. Supports decimal (KB/MB/GB) and binary (KiB/MiB/GiB) unit systems. Stateless and purely presentational.
Copyright © 2026