quickjs-tart

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

CURLOPT_RESUME_FROM_LARGE.md (1954B)


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