CURLINFO_SIZE_DOWNLOAD(3)

πŸ’– CURLINFO_SIZE_DOWNLOAD(3) πŸ’–

okay so bestie, welcome to the CURLINFO_SIZE_DOWNLOAD page β€” this one lives in the curl library functions manual, and it's literally just "how many bytes did I download," but make it ✨dramatic✨.


🌸 NAME 🌸

CURLINFO_SIZE_DOWNLOAD β€” number of downloaded bytes πŸŽ€


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD, double *dlp);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you pass a pointer to a double, and curl fills it with the total amount of bytes that were downloaded. That's it. That's the whole personality. πŸ’…

Important tea though β€” the amount is only for the latest transfer, and it gets reset again for each new transfer. So don't be out here thinking it's a lifetime total, because it is not, and it will humble you. πŸ™ˆ

It counts actual payload data, aka what everyone commonly calls the body. All the meta and header data is excluded and not included in this number. So it's just the good stuff, none of the packaging. πŸ“¦

Also, quick heads up: CURLINFO_SIZE_DOWNLOAD_T(3) is the newer replacement that returns a more sensible variable type. So like… she's the upgraded version, iykyk. πŸ‘‘


🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. yes, all of them. no gatekeeping here. 🫢


πŸ“ 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 */
      double dl;
      result = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD, &dl);
      if(!result) {
        printf("Downloaded %.0f bytes\n", dl);
      }
    }
  }
}

look at her go. iconic behavior honestly. ⭐


πŸ’€ DEPRECATED πŸ’€

Deprecated since 7.55.0. yeah she's giving legacy main character energy β€” still works, but the new girl is right there. 😭


🧚 AVAILABILITY 🧚

Added in curl 7.4.1. she's been around a minute. πŸ‘‘


πŸ’œ 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 β€” go check libcurl-errors(3) for the full breakdown, bestie. πŸ”₯


πŸŽ€ SEE ALSO πŸŽ€


k that's the whole page, mwah πŸ’‹ β€” brought to you by libcurl, dated 2026-10-12, and yes the original footer said CURLINFO_SIZE_DOWNLOAD(3) so we're keeping that energy. go download some bytes responsibly, bestie πŸŒΈπŸ¦‹πŸ’–

πŸ“¦ where this page comes from