FileSizeUnit uses ConstantsTrait
FileSizeUnit
Enumeration of the binary (base-1024) file-size unit symbols used to render human-readable sizes, from bytes up to petabytes.
Tags
Table of Contents
Constants
- B : string = 'B'
- Bytes.
- GB : string = 'GB'
- Gigabytes (1024 MB).
- KB : string = 'KB'
- Kilobytes (1024 bytes).
- MB : string = 'MB'
- Megabytes (1024 KB).
- PB : string = 'PB'
- Petabytes (1024 TB).
- TB : string = 'TB'
- Terabytes (1024 GB).
Methods
- ordered() : array<int, string>
- Returns the unit symbols ordered by ascending magnitude (base 1024).
Constants
B
Bytes.
public
string
B
= 'B'
GB
Gigabytes (1024 MB).
public
string
GB
= 'GB'
KB
Kilobytes (1024 bytes).
public
string
KB
= 'KB'
MB
Megabytes (1024 KB).
public
string
MB
= 'MB'
PB
Petabytes (1024 TB).
public
string
PB
= 'PB'
TB
Terabytes (1024 GB).
public
string
TB
= 'TB'
Methods
ordered()
Returns the unit symbols ordered by ascending magnitude (base 1024).
public
static ordered() : array<int, string>
The index of each symbol is the power of 1024 it represents
(0 => B, 1 => KB, … 5 => PB).
Return values
array<int, string> —The ordered list of unit symbols.