GNURLINFO...DOWNLOAD_T(3)
okay bestie, welcome to GNURLINFO...DOWNLOAD_T(3) β it lives under the curl_easy_getinfo options umbrella, and it's here to spill the tea on downloaded bytes. π
β¨
β¨ NAME β¨
CURLINFO_SIZE_DOWNLOAD_T β get the number of downloaded bytes. π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T,
curl_off_t *dlp);
πΈ DESCRIPTION πΈ
Okay so you pass in a pointer to a curl_off_t, and it receives the total amount of bytes that were downloaded. π
The amount is only for the latest transfer and will be reset again for each new transfer β so don't treat it like a forever-total, bestie.
This counts actual payload data, what's also commonly called body. All meta and header data are excluded and will not be counted in this number. periodt. π
π PROTOCOLS π
All. That's it β every protocol, no cap. π
π EXAMPLE π
Here's the whole vibe in code form:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* Perform the request */
res = curl_easy_perform(curl);
if(!res) {
/* check the size */
curl_off_t dl;
res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl);
if(!res) {
printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl);
}
}
}
β AVAILABILITY β
Added in 7.55.0. iconic behavior, honestly. π«Ά
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. fr fr.
π₯ SEE ALSO π₯
mwah π this page comes from libcurl 7.55.0, dated 25 May 2017, and the manual title is GNURLINFO...DOWNLOAD_T(3). go download some bytes and drink water, bestie ππ§π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms