src/Entity/FileEntity.php
public function getPrettySize()
    {
        $size = $this->getLength();
        
        if ($size >= 1073741824) {
            return round($size / 1073741824, 2) . ' GB';
        }
        
        if ($size >= 1048576) {
            return round($size / 1048576, 2) . ' MB';
        }
        
        if ($size >= 1024) {
            return round($size / 1024, 2) . ' kB';
        }
        
        return (string)$size;
    }
public function getPrettySize()
    {
        $size = $this->getLength();
        
        if ($size >= 1073741824) {
            return round($size / 1073741824, 2) . ' GB';
        }
        
        if ($size >= 1048576) {
            return round($size / 1048576, 2) . ' MB';
        }
        
        if ($size >= 1024) {
            return round($size / 1024, 2) . ' kB';
        }
        
        return (string)$size;
    }
Gets the length of file in GB, MB ot kB format

@return string