format_bytes - Twig Filter
The format_bytes filter converts a number representing bytes into a human readable format like “128.0 MiB”.
You can also adjust how many decimal places will be output.
Internally this functions calls Contao\System::getReadableSize() and uses the MSC.decimalSeparator,
MSC.thousandsSeparator and UNITS.* labels from the contao_default translation domain, where UNITS.0 starts with
“bytes”, then UNITS.1 is “KiB” etc. Thus if you adjust the translations to
then the output of {{ 134217728|format_bytes }} will be “128.0 MB” instead.
Arguments
decimals: The number of decimal places to show (default:1).