private function formatSize($bytes)
    {
        $unit = 1024;
        if ($bytes <= $unit) {
            return $bytes.' b';
        }
        $exp = (int)(log($bytes) / log($unit));
        $pre = 'kMGTPE';
        $pre = $pre[$exp - 1];

        return sprintf('%.1f %sB', $bytes / pow($unit, $exp), $pre);
    }