1CURLINFO_SIZE_DOWNLOAD(3)  curl_easy_getinfo options CURLINFO_SIZE_DOWNLOAD(3)
2
3
4

NAME

6       CURLINFO_SIZE_DOWNLOAD - get the number of downloaded bytes
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD, double *dlp);
12

DESCRIPTION

14       Pass  a  pointer  to a double to receive the total amount of bytes that
15       were downloaded.  The amount is only for the latest transfer  and  will
16       be  reset again for each new transfer. This counts actual payload data,
17       what's also commonly called body. All meta and header data are excluded
18       and will not be counted in this number.
19
20       CURLINFO_SIZE_DOWNLOAD_T(3)  is a newer replacement that returns a more
21       sensible variable type.
22

PROTOCOLS

24       All
25

EXAMPLE

27       CURL *curl = curl_easy_init();
28       if(curl) {
29         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
30
31         /* Perform the request */
32         res = curl_easy_perform(curl);
33
34         if(!res) {
35           /* check the size */
36           double dl;
37           res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
38           if(!res) {
39             printf("Downloaded %.0f bytes\n", cl);
40           }
41         }
42       }
43

AVAILABILITY

45       Added in 7.4.1
46

RETURN VALUE

48       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
49       if not.
50

SEE ALSO

52       curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_SIZE_DOWNLOAD_T(3),
53       CURLINFO_SIZE_UPLOAD_T(3),
54
55
56
57libcurl 7.82.0                 November 26, 2021     CURLINFO_SIZE_DOWNLOAD(3)
Impressum