core/common/bytes.pipe.ts
Converts the file size to a readable format. Supports both decimal (default) and binary units.
Usage:
Example :{{ myData | bytes }} <!-- e.g. 100.1 MB (decimal) -->
{{ myData | bytes:2 }} <!-- e.g. 100.12 MB (decimal) -->
{{ myData | bytes:1:true }} <!-- e.g. 97.7 MiB (binary) -->
{{ myData | bytes:{binary: true} }} <!-- e.g. 97.7 MiB (binary) -->
{{ myData | bytes:{precision: 2, binary: true} }} <!-- e.g. 97.66 MiB (binary) -->
Options object properties:
Decimal units: bytes, kB, MB, GB, TB, PB Binary units: bytes, KiB, MiB, GiB, TiB, PiB
Name | bytes |
Standalone | true |
Static bytes | ||||||||||||||||||||
bytes(bytes: number, precisionOrOptions: number | BytesOptions, binary, translateService?: TranslateService)
|
||||||||||||||||||||
Parameters :
Returns :
string | number
|
transform | ||||||||||||||||
transform(value: number, precisionOrOptions: number | BytesOptions, binary)
|
||||||||||||||||
Parameters :
Returns :
string | number
|