GNURLINFO_...D_DOWNLOAD(3)

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

okay so welcome to GNURLINFO_...D_DOWNLOAD(3), bestie β€” this page comes from the curl_easy_getinfo options manual, and it’s all about getting that download speed πŸ’…βœ¨

πŸ’– NAME πŸ’–

CURLINFO_SPEED_DOWNLOAD β€” get download speed πŸƒβ€β™€οΈπŸ’¨

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD, double
*speed);

🌸 DESCRIPTION 🌸

Okay so you pass a pointer to a double, and it receives the average download speed that curl measured for the complete download. It’s measured in bytes/second, periodt πŸ’–

CURLINFO_SPEED_DOWNLOAD_T(3) is a newer replacement that returns a more sensible variable type. Slay, newer type πŸ’…

πŸ¦‹ PROTOCOLS πŸ¦‹

There are no protocol entries listed under this heading in the original page β€” it’s giving blank canvas, bestie 🫢

πŸŽ€ EXAMPLE πŸŽ€

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) {
    double speed;
    res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
    if(!res) {
      printf("Download speed %.0f bytes/sec\n", ul);
    }
  }
}
Copy it exactly, including that ul at the end β€” no cap, don’t get creative with it πŸ’€

⭐ AVAILABILITY ⭐

Added in 7.4.1 🌟

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. That’s the whole vibe check 😭

🌈 SEE ALSO 🌈


Cute sign-off time: this icon of a page is from libcurl 7.44.0, dated 28 Aug 2015. Bye bestie, go measure that download speed πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from