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
12 *dlp);
13
15 Pass a pointer to a double to receive the total amount of bytes that
16 were downloaded. The amount is only for the latest transfer and will
17 be reset again for each new transfer. This counts actual payload data,
18 what's also commonly called body. All meta and header data are excluded
19 and will not be counted in this number.
20
21 CURLINFO_SIZE_DOWNLOAD_T(3) is a newer replacement that returns a more
22 sensible variable type.
23
25 All
26
28 CURL *curl = curl_easy_init();
29 if(curl) {
30 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
31
32 /* Perform the request */
33 res = curl_easy_perform(curl);
34
35 if(!res) {
36 /* check the size */
37 double dl;
38 res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
39 if(!res) {
40 printf("Downloaded %.0f bytes\n", cl);
41 }
42 }
43 }
44
46 Added in 7.4.1
47
49 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
50 if not.
51
53 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_SIZE_DOWNLOAD_T(3),
54 CURLINFO_SIZE_UPLOAD_T(3),
55
56
57
58libcurl 7.79.1 November 04, 2020 CURLINFO_SIZE_DOWNLOAD(3)