1CURLINFO_SIZE_DOWNLOAD_T(3) libcurl CURLINFO_SIZE_DOWNLOAD_T(3)
2
3
4
6 CURLINFO_SIZE_DOWNLOAD_T - get the number of downloaded bytes
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T,
12 curl_off_t *dlp);
13
15 Pass a pointer to a curl_off_t to receive the total amount of bytes
16 that were downloaded. The amount is only for the latest transfer and
17 will be reset again for each new transfer. This counts actual payload
18 data, what's also commonly called body. All meta and header data are
19 excluded and will not be counted in this number.
20
22 All
23
25 CURL *curl = curl_easy_init();
26 if(curl) {
27 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
28
29 /* Perform the request */
30 res = curl_easy_perform(curl);
31
32 if(!res) {
33 /* check the size */
34 curl_off_t dl;
35 res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl);
36 if(!res) {
37 printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl);
38 }
39 }
40 }
41
43 Added in 7.55.0
44
46 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
47 if not.
48
50 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_SIZE_DOWNLOAD(3),
51 CURLINFO_SIZE_UPLOAD_T(3),
52
53
54
55ibcurl 8.2.1 April 26, 2023 CURLINFO_SIZE_DOWNLOAD_T(3)