src/CURL.php
public function downloadResume(string $filePath, string $url, array $headers = []) {
        try {
            $pos = 0;
            if (is_file($filePath)) {
                $pos = filesize($filePath);
            }
            error_clear_last();
            $fp = fopen($filePath, 'ab');
            if ($fp === false && ($error = error_get_last())) {
                throw new IOException($error['message'], $error['type']);
            }
            $c = $this->curlDownloadInit($url, $headers, $fp);
            curl_setopt($c, CURLOPT_RESUME_FROM, $pos);
            if (!curl_exec($c)) {
                throw new CURLException(curl_error($c), curl_errno($c));
            }
        } finally {
            is_resource($c ?? null) && curl_close($c);
            is_resource($fp ?? null) && fclose($fp);
        }
    }
public function downloadResume(string $filePath, string $url, array $headers = []) {
        try {
            $pos = 0;
            if (is_file($filePath)) {
                $pos = filesize($filePath);
            }
            error_clear_last();
            $fp = fopen($filePath, 'ab');
            if ($fp === false && ($error = error_get_last())) {
                throw new IOException($error['message'], $error['type']);
            }
            $c = $this->curlDownloadInit($url, $headers, $fp);
            curl_setopt($c, CURLOPT_RESUME_FROM, $pos);
            if (!curl_exec($c)) {
                throw new CURLException(curl_error($c), curl_errno($c));
            }
        } finally {
            is_resource($c ?? null) && curl_close($c);
            is_resource($fp ?? null) && fclose($fp);
        }
    }
public function downloadResume ( string $ filePath , string $ url , array $ headers = [ ] ) { try { $ pos = 0 ; if ( is_file ( $ filePath ) ) { $ pos = filesize ( $ filePath ) ; } error_clear_last ( ) ; $ fp = fopen ( $ filePath , 'ab' ) ; if ( $ fp === false && ( $ error = error_get_last ( ) ) ) { throw new IOException ( $ error [ 'message' ] , $ error [ 'type' ] ) ; } $ c = $ this -> curlDownloadInit ( $ url , $ headers , $ fp ) ; curl_setopt ( $ c , CURLOPT_RESUME_FROM , $ pos ) ; if ( ! curl_exec ( $ c ) ) { throw new CURLException ( curl_error ( $ c ) , curl_errno ( $ c ) ) ; } } finally { is_resource ( $ c ?? null ) && curl_close ( $ c ) ; is_resource ( $ fp ?? null ) && fclose ( $ fp ) ; } }
@param string $filePath
@param string $url
@param array  $headers

@throws CURLException
@throws IOException
@param string $filePath @param string $url @param array $headers