GNURLINFO_...D_DOWNLOAD(3)
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
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, 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