curl-users
Re: Download head of file
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 4 Sep 2006 10:30:27 +0200 (CEST)
Date: Mon, 4 Sep 2006 10:30:27 +0200 (CEST)
On Mon, 4 Sep 2006, Oleg Lomaka wrote:
> I've tried this. But in this case curl will stop transfer not after 2048
> bytes will be received, but when pipe will be closed and it can't write
> there next part of data. For example when i use --max-hard-filesize, curl
> gets 2353 bytes, using head - 4111.
Then I'd suggest:
curl --range "0-2047" [URL] | head -c 2048
... since that would make range-accepting servers only provide the amount
you're interested in, and only the ones that aren't acknowledging Range: will
provide more and let head cut it. Mostly since this is possible to do with a
non-patched curl.
The 2353 vs 4111 will of course vary greatly between operating systems,
networks and servers.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2006-09-04