Will read and return $bytes bytes from file. Will advance pointer by $bytes bytes.

@param int $bytes

@return string
546225
public function read($bytes)
    {
        $content = $this->file->data();

        $return = substr($content, $this->position(), $bytes);

        $newPosition = $this->position()+$bytes;

        $newPosition = $newPosition > strlen($content) ? strlen($content) : $newPosition;

        $this->position($newPosition);
        $this->file->setAccessTime(time());

        return $return;
    }
676326
public function stream_read($bytes)
    {
        if (!$this->currentlyOpenedFile->isOpenedForReading()) {
            return null;
        }
        $data = $this->currentlyOpenedFile->read($bytes);
        //file access time changes so stat cache needs to be cleared
        clearstatcache();

        return $data;
    }
1272128
public function EntryRead($Bytes = -1)
    {
        $Actual = $this->EntryActualSize();
        if ($Bytes < 0 || $Bytes > $Actual) {
            $Bytes = $Actual;
        }
        return $Bytes > 0 ? $this->ZipObject->getFromIndex($this->Index, $Bytes) : '';
    }
579911
private function limitBytes($bytes)
    {
        if ($bytes === null) {
            return $this->content;
        } elseif (intval($bytes) < (self::BYTE_LIMIT * 0.046875)) {
            // less than 24 kilobytes (512 kilobytes * 0.046875)
            throw new \InvalidArgumentException('Byte limit is set dangerously low! Default value=' . self::BYTE_LIMIT);
        }
        return $this->content = mb_strcut($this->content, 0, intval($bytes));
    }
231957
public static function resizeBytes($bytes)
    {
        static $units = ['b', 'kb', 'mb', 'gb', 'tb', 'pb'];

        /** @noinspection PhpIllegalArrayKeyTypeInspection */

        return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), 2) . $units[$i];
    }
1099994
private function fileSizeConvert(int $bytes)
    {
        $bytes = floatval($bytes);
        $result = "0 B";
        $arBytes = array(
            0 => array(
                "UNIT" => "TB",
                "VALUE" => pow(1024, 4)
            ),
            1 => array(
                "UNIT" => "GB",
                "VALUE" => pow(1024, 3)
            ),
            2 => array(
                "UNIT" => "MB",
                "VALUE" => pow(1024, 2)
            ),
            3 => array(
                "UNIT" => "KB",
                "VALUE" => 1024
            ),
            4 => array(
                "UNIT" => "B",
                "VALUE" => 1
            ),
        );

        foreach ($arBytes as $arItem) {
            if ($bytes >= $arItem["VALUE"]) {
                $result = $bytes / $arItem["VALUE"];
                $result = str_replace(".", ",", strval(round($result, 2)))." ".$arItem["UNIT"];
                break;
            }
        }
        return $result;
    }
1200140
static public function bytesToSize($bytes, $precision = 2)
    {
        $kilobyte = 1024;
        $megabyte = $kilobyte * 1024;
        $gigabyte = $megabyte * 1024;
        $terabyte = $gigabyte * 1024;

        if (($bytes >= 0) && ($bytes < $kilobyte)) {
            return $bytes . ' B';

        } elseif (($bytes >= $kilobyte) && ($bytes < $megabyte)) {
            return round($bytes / $kilobyte, $precision) . ' KB';

        } elseif (($bytes >= $megabyte) && ($bytes < $gigabyte)) {
            return round($bytes / $megabyte, $precision) . ' MB';

        } elseif (($bytes >= $gigabyte) && ($bytes < $terabyte)) {
            return round($bytes / $gigabyte, $precision) . ' GB';

        } elseif ($bytes >= $terabyte) {
            return round($bytes / $terabyte, $precision) . ' TB';
        } else {
            return $bytes . ' B';
        }
    }
373705
public function EntryRead($Bytes = -1)
    {
        $Actual = $this->EntryActualSize();
        if ($Bytes < 0 || $Bytes > $Actual) {
            $Bytes = $Actual;
        }
        $Output = '';
        if ($Bytes > 0 && ($Stream = $this->RarEntry->getStream())) {
            $Output .= fread($Stream, $this->RarEntry->getUnpackedSize());
            fclose($Stream);
        }
        return $Output;
    }
352376
public static function fromBytes(array $bytes)
    {
        $result = null;
        if (count($bytes) === 4) {
            $chunks = array_map(
                function ($byte) {
                    return (is_int($byte) && $byte >= 0 && $byte <= 255) ? (string) $byte : false;
                },
                $bytes
            );
            if (in_array(false, $chunks, true) === false) {
                $result = new static(implode('.', $chunks));
            }
        }

        return $result;
    }
1064223
public static function bytes_pretty_print($bytes)
    {
        if ($bytes < 1024) {
            return $bytes . " B";
        }

        $kbytes = $bytes / 1024;

        if ($kbytes < 1024) {
            return round($kbytes, 3) . " KB";
        }

        $mbytes = $kbytes / 1024;

        if ($mbytes < 1024) {
            return round($mbytes, 3) . " MB";
        }

        $tbytes = $mbytes / 1024;

        if ($tbytes < 1024) {
            return round($tbytes, 3) . " TB";
        }

        $gbytes = $tbytes / 1024;

        return round($gbytes, 3) . " GB";
    }
1156490
final static public function sizeBytesToText (int $bytes=0) : string
	{
		if ($bytes >= pow(1024,8)) 			return number_format($bytes / pow(1024,8), 2) . ' YB';
		elseif ($bytes >= pow(1024,7)) 		return number_format($bytes / pow(1024,7), 2) . ' ZB';
		elseif ($bytes >= pow(1024,6)) 		return number_format($bytes / pow(1024,6), 2) . ' EB';
		elseif ($bytes >= pow(1024,5)) 		return number_format($bytes / pow(1024,5), 2) . ' PB';
		elseif ($bytes >= pow(1024,4)) 		return number_format($bytes / pow(1024,4), 2) . ' TB';
		elseif ($bytes >= pow(1024,3)) 		return number_format($bytes / pow(1024,3), 2) . ' GB';
		elseif ($bytes >= pow(1024,2)) 		return number_format($bytes / pow(1024,2), 2) . ' MB';
		elseif ($bytes >= pow(1024,1)) 		return number_format($bytes / pow(1024,1), 2) . ' KB';		
		elseif ($bytes > 1) 				return $bytes . ' bytes';		
		elseif ($bytes <= 1) 				return $bytes . ' byte';
	}
314549
public function readData($bytes, $extra = self::EOL_LENGTH)
    {
        $this->ensureConnected();

        $data = $this->socket->readData($bytes + $extra);

        return substr($data, 0, $bytes);
    }
1176065
public function decodeBytes($bytes)
    {
        if (strlen($bytes) !== 16) {
            throw new InvalidArgumentException('$bytes string should contain 16 characters.');
        }

        $hexUuid = unpack('H*', $bytes);

        return $this->decode($hexUuid[1]);
    }
1358072
private function getCodePoint($bytes)
    {
        if (\strlen($bytes) === 2) {
            return ((\ord($bytes[0]) & 0b11111) << 6)
                | (\ord($bytes[1]) & 0b111111);
        }

        if (\strlen($bytes) === 3) {
            return ((\ord($bytes[0]) & 0b1111) << 12)
                | ((\ord($bytes[1]) & 0b111111) << 6)
                | (\ord($bytes[2]) & 0b111111);
        }

        return ((\ord($bytes[0]) & 0b111) << 18)
            | ((\ord($bytes[1]) & 0b111111) << 12)
            | ((\ord($bytes[2]) & 0b111111) << 6)
            | (\ord($bytes[3]) & 0b111111);
    }
268393
public function formatFilesize($bytes)
    {
        $units = array('bytes', 'kb', 'MB', 'GB', 'TB', 'PB');
        $level = floor(log($bytes)/log(1024));

        $output = sprintf('%.2f %s', ($bytes/pow(1024, floor($level))), $units[$level]);

        return $output;
    }
1232829
private function formatSize($bytes)
    {
        $units = ['B', 'KB', 'MB', 'GB', 'TB'];

        $bytes = max($bytes, 0);
        $pow = $bytes ? floor(log($bytes, 1024)) : 0;
        $pow = min($pow, count($units) - 1);

        $bytes /= pow(1024, $pow);

        return number_format($bytes, 2).' '.$units[$pow];
    }
958193
function formatBytes($bytes)
    {
        $bytes = floatval($bytes);
        $arBytes = array(
            0 => array(
                "UNIT" => "TB",
                "VALUE" => pow(1024, 4)
            ),
            1 => array(
                "UNIT" => "GB",
                "VALUE" => pow(1024, 3)
            ),
            2 => array(
                "UNIT" => "MB",
                "VALUE" => pow(1024, 2)
            ),
            3 => array(
                "UNIT" => "KB",
                "VALUE" => 1024
            ),
            4 => array(
                "UNIT" => "B",
                "VALUE" => 1
            ),
        );

        foreach($arBytes as $arItem)
        {
            if($bytes >= $arItem["VALUE"])
            {
                $result = $bytes / $arItem["VALUE"];
                $result = str_replace(".", "," , strval(round($result, 2)))." ".$arItem["UNIT"];
                break;
            }
        }
        return $result;
    }