function formatBytes
formatBytes(bytes: number): string

Returns bytes as a size in bytes, kilobytes or megabytes, where a kilobyte is 1024 bytes, in the app's language ("1.5 kB", "1,5 ko"). Intl names the units, so they follow the language without a catalog.

Parameters

bytes: number

Return Type

string

Usage

import { formatBytes } from "src/utils/shared/format.ts";