CURLOPT_MAXFILESIZE_LARGE(3)
π CURLOPT_MAXFILESIZE_LARGE(3) β like, the libcurl manual bestie π
okay so this is a page from the Library Functions Manual and it's about setting a maximum file size you're willing to download. no cap, it's more useful than it sounds. let's get into it β¨
πΈ NAME πΈ
CURLOPT_MAXFILESIZE_LARGE β the maximum file size allowed to download, bestie. that's the whole vibe.
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXFILESIZE_LARGE,
curl_off_t size);
β¨ DESCRIPTION β¨
so you pass a curl_off_t as the parameter, okay? this specifies the maximum accepted size (in bytes) of a file to download. if the file you requested turns out to be larger than this value, the transfer is aborted and CURLE_FILESIZE_EXCEEDED is returned. slay, boundaries π
passing a zero size disables this whole thing, and passing a negative size yields a CURLE_BAD_FUNCTION_ARGUMENT (as it should, honestly, negative file sizes are not the moment π).
girlies listen up: the file size is not always known prior to the download start, and for such transfers this option has no effect β even if the file transfer eventually ends up being larger than this given limit. so like, it can't save you in every scenario, just so you know π
since 8.4.0, this option also stops ongoing transfers if they reach this threshold. she's proactive now, we love growth π
π DEFAULT π
0, meaning disabled. the "no thoughts, head empty" default.
π PROTOCOLS π
this functionality affects ftp, http and mqtt
π§ EXAMPLE π§
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_off_t ridiculous = (curl_off_t)1 << 48;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
/* refuse to download if larger than ridiculous */
curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, ridiculous);
result = curl_easy_perform(curl);
}
}
the variable is literally called ridiculous and honestly? iconic. (curl_off_t)1 << 48 is a whole lotta bytes and that's the point π
β AVAILABILITY β
Added in curl 7.11.0 β she's been around a minute, respect the elders π«Ά
π₯ 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, see libcurl-errors(3). like, go read that one if something's acting up, iykyk.
π SEE ALSO π
the whole friend group, fr fr π
and that's the whole page, bestie β mwah π this manual page came to you from libcurl, dated 2026-10-12, and yes she ate π β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms