src/Helpers/File.php
public static function readableSize($bytes, $precision = 1)
    {
        static $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
        if ($bytes === 0) {
            return '0 '.$units[0];
        }
        $exponent = floor(log($bytes, 1024));
        $value = $bytes / pow(1024, $exponent);

        return round($value, $precision).' '.$units[$exponent];
    }
public static function readableSize($bytes, $precision = 1)
    {
        static $units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
        if ($bytes === 0) {
            return '0 '.$units[0];
        }
        $exponent = floor(log($bytes, 1024));
        $value = $bytes / pow(1024, $exponent);

        return round($value, $precision).' '.$units[$exponent];
    }
public static function readableSize ( $ bytes , $ precision = 1 ) { static $ units = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' ] ; if ( $ bytes === 0 ) { return '0 ' . $ units [ 0 ] ; } $ exponent = floor ( log ( $ bytes , 1024 ) ) ; $ value = $ bytes / pow ( 1024 , $ exponent ) ; return round ( $ value , $ precision ) . ' ' . $ units [ $ exponent ] ; }
Generate a human readable bytecount string.
@param  int  $bytes
@param  int $precision
@return string
Generate a human readable bytecount string .