cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Downloading last 128 Bytes of a file.

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Sun, 30 May 2010 14:46:57 -0500

On Sun, May 30, 2010 at 6:09 AM, п√п╦я─п╟п╧я─ п п╟п╥п╟я─п╬я│я▐п╫ <sdtjeck_at_yandex.com> wrote:
> Hi! I wanna dowload the last 128 bytes of a file via CURL on C. How can I do
> it?
> I think, I can do it via CURLOPT_RESUME_FROM, but I don't now how to detect
> size of a file without full downloading.
> What can you recommend me?

First, download only headers using:
CURLOPT_NOBODY

Then use curl_easy_getinfo() with:
CURLINFO_CONTENT_LENGTH_DOWNLOAD
to find out the size of the remote file.

(If it says zero, maybe the server doesn't support this)

 - Jeff
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-30