quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_RESUME_FROM.md (1864B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_RESUME_FROM
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_INFILESIZE (3)
      9   - CURLOPT_RANGE (3)
     10   - CURLOPT_RESUME_FROM_LARGE (3)
     11 Protocol:
     12   - All
     13 Added-in: 7.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_RESUME_FROM - offset to resume transfer from
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM, long from);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a long as parameter. It contains the offset in number of bytes that you
     31 want the transfer to start from. Set this option to 0 to make the transfer
     32 start from the beginning (effectively disabling resume). For FTP, set this
     33 option to -1 to make the transfer start from the end of the target file
     34 (useful to continue an interrupted upload).
     35 
     36 When doing uploads with FTP, the resume position is where in the local/source
     37 file libcurl should try to resume the upload from and it then appends the
     38 source file to the remote target file.
     39 
     40 If you need to resume a transfer beyond the 2GB limit, use
     41 CURLOPT_RESUME_FROM_LARGE(3) instead.
     42 
     43 # DEFAULT
     44 
     45 0, not used
     46 
     47 # %PROTOCOLS%
     48 
     49 # EXAMPLE
     50 
     51 ~~~c
     52 int main(void)
     53 {
     54   CURL *curl = curl_easy_init();
     55   if(curl) {
     56     long size_of_file = 6789;
     57 
     58     curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
     59 
     60     /* resume upload at byte index 200 */
     61     curl_easy_setopt(curl, CURLOPT_RESUME_FROM, 200L);
     62 
     63     /* ask for upload */
     64     curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
     65 
     66     /* set total data amount to expect */
     67     curl_easy_setopt(curl, CURLOPT_INFILESIZE, size_of_file);
     68 
     69     /* Perform the request */
     70     curl_easy_perform(curl);
     71   }
     72 }
     73 ~~~
     74 
     75 # %AVAILABILITY%
     76 
     77 # RETURN VALUE
     78 
     79 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     80 
     81 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     82 libcurl-errors(3).