Attention

TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.

Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.

format.bytes

Formats an integer with a byte count into human readable form.

Examples

Simple

{fileSize -> f:format.bytes()}

123 KB Depending on the value of {fileSize}.

With arguments

{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')}

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\')}'

123 KB Depending on the value of {fileSize}.

Arguments

value

DataType

mixed

Required

false

Description

The incoming data to convert, or NULL if VH children should be used

decimals

DataType

mixed

Required

false

Description

The number of digits after the decimal point

decimalSeparator

DataType

string

Default

'.'

Required

false

Description

The decimal point character

thousandsSeparator

DataType

string

Default

','

Required

false

Description

The character for grouping the thousand digits

units

DataType

string

Required

false

Description

Comma separated list of available units, default is LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid')