GNURLOPT_BUFFERSIZE(3)
π GNURLOPT_BUFFERSIZE(3) π
okay bestie, this is from the curl_easy_setopt options manual, and itβs literally all about giving libcurl a preferred receive-buffer size. slay.
β¨ NAME β¨
CURLOPT_BUFFERSIZE β set preferred receive buffer size. periodt.
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size);
π DESCRIPTION π
bestie, you pass a long that says the size you prefer (in bytes) for libcurlβs receive buffer. the main point? your write callback gets called more often and with smaller chunks. secondly, for some protocols, thereβs a benefit of having a larger buffer for performance. highkey a glow-up.
this is just treated as a request, not an order. you cannot be guaranteed to actually get the given size. no cap.
this buffer size is by default CURL_MAX_WRITE_SIZE (16kB). the maximum buffer size allowed to be set is CURL_MAX_READ_SIZE (512kB). the minimum buffer size allowed to be set is 1024. those are the numbers, bestie π
π¦ DEFAULT π¦
CURL_MAX_WRITE_SIZE (16kB) β iconic default behavior π«Ά
π PROTOCOLS π
All. every single one, we love an inclusive buffer option β¨
π EXAMPLE π
hereβs the whole vibe:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
/* ask libcurl to allocate a larger receive buffer */
curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
π§ AVAILABILITY π§
Added in 7.10. Growing the buffer was added in 7.53.0. history bestie π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. thatβs the whole return-value story, bestie π
β SEE ALSO β
these two are the SEE ALSO besties β go read them too, iykyk π
mwah π this page is from libcurl 7.37.0, dated 17 Jun 2014 β thatβs the footer, bestie, catch you in the next manual π«Άπ
π¦ 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