Core/Toolbox/Converter/Filesize.php
public function byteToSize(array $units = null, string $format = '%d%s')
    {
        if (!$this->value == '0' . $this->value) {
            Throw new ConverterException(sprintf('Wrong parameter type'));
        }

        if ($this->value > 0) {
            $unit = intval(log($this->value, 1024));

            if (!isset($units)) {
                $units = [
                    'K',
                    'M',
                    'G',
                    'T',
                    'P'
                ];
            }

            if (array_key_exists($unit, $units) === true) {
                return $this->result = sprintf($format, $this->value / pow(1024, $unit), $units[$unit]);
            }
        }

        return $this->result = $this->value;
    }
public function byteToSize(array $units = null, string $format = '%d%s')
    {
        if (!$this->value == '0' . $this->value) {
            Throw new ConverterException(sprintf('Wrong parameter type'));
        }

        if ($this->value > 0) {
            $unit = intval(log($this->value, 1024));

            if (!isset($units)) {
                $units = [
                    'K',
                    'M',
                    'G',
                    'T',
                    'P'
                ];
            }

            if (array_key_exists($unit, $units) === true) {
                return $this->result = sprintf($format, $this->value / pow(1024, $unit), $units[$unit]);
            }
        }

        return $this->result = $this->value;
    }
Converts a filesize (bytes as integer) into a human readable string format.
For example: 1024 => 1K

@param array $units
Optional unit strings
@param string $format
The outputformat

@throws ConverterException

@return string unknown