File

packages/eui/packages/components/eui-file-upload/pipes/filesize.pipe.ts

Description

A pipe that transforms a file size in bytes into a human-readable format (e.g., KB, MB, GB).

Example :
{{ 1024 | filesize }}  // Outputs: "1.00 KB"
{{ 1048576 | filesize:1 }}  // Outputs: "1.0 MB"

Metadata

Methods

transform
transform(bytes: number, precision: number)

Method used to format a size.

Parameters :
Name Type Optional Default value Description
bytes number No 0

Bytes to format.

precision number No 2

Number of decimal

Returns : string

String with formated size and unit.

results matching ""

    No results matching ""