format.bytes¶
Formats an integer with a byte count into human-readable form.
Examples¶
Defaults:
{fileSize -> f:format.bytes()}
Output:
123 KB
// depending on the value of {fileSize}
Defaults:
{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')}
Output:
1,023.00 B
// depending on the value of {fileSize}
You may provide an own set of units, like this: B,KB,MB,GB,TB,PB,EB,ZB,YB custom units:
{fileSize -> f:format.bytes(units: '{f:translate(\'viewhelper.format.bytes.units\', \'fluid\')}'
Output:
123 KB
// depending on the value of {fileSize}
Arguments¶
value¶
- DataType
- mixed
- Required
- true
- Description
- The incoming data to convert, or NULL if VH children should be used
decimals¶
- DataType
- mixed
- Required
- true
- Description
- The number of digits after the decimal point
decimalSeparator¶
- DataType
- string
- Default
- ‘.’
- Required
- true
- Description
- The decimal point character
thousandsSeparator¶
- DataType
- string
- Default
- ‘,’
- Required
- true
- Description
- The character for grouping the thousand digits
units¶
- DataType
- string
- Required
- true
- Description
- Comma separated list of available units, default is LocalizationUtility::translate(‘viewhelper.format.bytes.units’, ‘fluid’)