cURL / Mailing Lists / curl-library / Single Mail


Re: http file download using libcurl

From: Thorben Thuermer <>
Date: Mon, 22 Oct 2012 13:56:50 +0200

On Mon, 22 Oct 2012 19:12:00 +0800 JALINDAR <> wrote:
> Hi Forum,
> I need to download file with size of 4MB. I have seen the CURLOPT_WRITEFUNCTION
> function setting of curl handle. But it can download maximum of 100KB data
> at once when
> set to 1.
> How can I download large file in one go?
> <>

why would you want to receive the files in one go?
the normal approach is to have the writefunction collect the data it receives
until the transfer is done.
(for example by writing it to a file, or copying it to a memory buffer.)

the only way to achieve what you want would be to increase the buffer size,
but alas:
Pass a long specifying your preferred size (in bytes) for the receive buffer
in libcurl. The main point of this would be that the write callback gets called
more often and with smaller chunks. This is just treated as a request, not an
order. You cannot be guaranteed to actually get the given size. (Added in 7.10)
This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it only
makes sense to use this option if you want it smaller."

> *Thanks
> Jalindar

- T.
List admin:
Received on 2012-10-22