cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http file download using libcurl

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

On Mon, 22 Oct 2012 19:12:00 +0800 JALINDAR <jalindergat_at_gmail.com> 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
> CURLOPT_HEADER<http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHEADER>is
> set to 1.
>
> How can I download large file in one go?
> <http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHEADER>

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:
"CURLOPT_BUFFERSIZE
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: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-10-22