public static function readfile_chunked(string $file, bool $retbytes=true) {
		if (! $file || ! @\is_file($file)) {
			return false;
		}

		$buffer = '';
		$cnt = 0;
		$chunk_size = 1024 * 1024;

		if (false === ($handle = @\fopen($file, 'rb'))) {
			return false;
		}

		while (! @\feof($handle)) {
			$buffer = @\fread($handle, $chunk_size);
			echo $buffer;
			\ob_flush();
			\flush();
			if ($retbytes) {
				$cnt += \strlen($buffer);
			}
		}

		$status = @\fclose($handle);

		// Return number of bytes delivered like readfile() does.
		if ($retbytes && $status) {
			return $cnt;
		}

		return $status;
	}