File

dev-kit/src/format-bytes/format-bytes.pipe.ts

Description

Transforms a number of bytes into a human-readable string.

Example :
<span>{{ file.size | formatBytes }}</span>

File size is rounded to two decimal places by default. Use the decimals parameter to specify a different number of decimal places.

Example :
<span>{{ file.size | formatBytes: { decimals: 1 } }}</span>

You can also specify a unit to use. If the unit is not specified, the most appropriate unit is used. The unit must be of type TMemorySize.

Example :
<span>{{ file.size | formatBytes: { unit: MemorySize.MB } }}</span>

See UploadComponent See TMemorySize See MemorySize

Import

Example :
import { FormatBytesPipe } from '@talenra/components/dev-kit';

Metadata

Methods

transform
transform(value: number, opts?: literal type)
Parameters :
Name Type Optional
value number No
opts literal type Yes
Returns : string

results matching ""

    No results matching ""