cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: http stop before full page downloaded

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Fri, 11 Feb 2011 13:10:11 -0800

On Fri, Feb 11, 2011 at 12:29:47PM -0800, skip wrote:
> Is there a command line option to stop the file transfer before the
> entire file is transferred from an http source?
> My need is for getting a snapshot of an http page that is constantly
> being updated/appended through tail -f . I just want to get a few
> lines of the current http output and stop. Right now curl runs
> forever.

You can use the --range option to specify only a certain range of bytes
to download. But the server won't necessarily support that on all URLs.
You can always stop the download by piping the output of curl (to stdout)
to something like "head". curl will exit once the lines have been
received and the pipeline is killed.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-11