CURLINFO_SIZE_DOWNLOAD_T(3)
β¨ CURLINFO_SIZE_DOWNLOAD_T(3) β¨
okay bestie, welcome to the Library Functions Manual π this one's a lil curl page about counting your bytes, and honestly? it's giving "small but mighty." π¦
πΈ NAME πΈ
CURLINFO_SIZE_DOWNLOAD_T β number of downloaded bytes π
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T,
curl_off_t *dlp);
β¨ DESCRIPTION β¨
so basically, you pass a pointer to a curl_off_t β that's where the answer lands π«Ά β and it receives the total amount of bytes that were downloaded.
couple things to know, no cap:
- the amount is only for the latest transfer, and it gets reset again for each new transfer π
- this counts actual payload data, what's also commonly called body π
- all meta and header data is excluded from this amount π
like, it's the meat of the download, not the packaging. periodt. π
π PROTOCOLS π
this functionality affects all supported protocols β every single one, bestie, no favorites πβ¨
π§ EXAMPLE π§
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
result = curl_easy_perform(curl);
if(!result) {
/* check the size */
curl_off_t dl;
result = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl);
if(!result) {
printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl);
}
}
}
}
look at that little printf go ππ iconic behavior, honestly.
β AVAILABILITY β
added in curl 7.55.0 β a classic, we stan a veteran π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β
β non-zero means an error occurred π, see libcurl-errors(3) for the whole vibe check.
π¦ SEE ALSO π¦
CURLINFO_SIZE_DOWNLOAD(3)CURLINFO_SIZE_UPLOAD_T(3)CURLOPT_MAXFILESIZE(3)curl_easy_getinfo(3)curl_easy_setopt(3)
ngl, go read those too. iykyk π
mwah π bye bestie, go count those bytes β this page is from libcurl, dated 2026-10-12, and it's the CURLINFO_SIZE_DOWNLOAD_T(3) entry, slay πβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms