1CURLINFO_SIZE_DOWNLOAD(3) curl_easy_getinfo options CURLINFO_SIZE_DOWNLOAD(3)
2
3
4
6 CURLINFO_SIZE_DOWNLOAD - get the number of downloaded bytes
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD, double *dlp);
12
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
24 All
25
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
45 Added in 7.4.1. Deprecated since 7.55.0.
46
48 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
49 if not.
50
52 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_SIZE_DOWNLOAD_T(3),
53 CURLINFO_SIZE_UPLOAD_T(3),
54
55
56
57libcurl 8.0.1 January 02, 2023 CURLINFO_SIZE_DOWNLOAD(3)