GNURLINFO...DOWNLOAD_T(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

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