Re: Download only a part of file

Giganews Newsgroups
Subject: Re: Download only a part of file
Posted by:  Remy Lebeau (TeamB) (gambit…
Date: Sun, 3 Aug 2003

"Krzykacz Plamisty" <krzykacz_plamisty_wywal_…> wrote in
message news:6B8798989479E240krzykacz_plamisty_wywal_…

> Is there any posibility to download only a part of file
> (for example: from offset $1000 to the end of file)
> using TidHTTP or TidFTP Indy components?

Yes, but with conditions.

For TIdHTTP, it will only work on servers that support HTTP v1.1.  Set the
ProtocolVersion property to pv1_1 and set the Request.ContentRangeStart
property to the desired offset before calling Get().  You can also set the
Request.ContentRangeEnd property if you do not want to download to the end
of the file.  It is your own responsibility to verify the server's version
before relying on the response containing either a partial file or an entire

For TIdFTP, it will only work if the server support file resuming.  Check
the CanResume property after connecting to the server.  When calling Get(),
set the AResume prameter to true, and you must specify a file that already
contains $1000 bytes, or a TStream that contains $1000 bytes, in order for
the transfer to be resumable at an ofset of $1000.




In response to

Download only a part of file posted by Krzykacz Plamisty on Sun, 3 Aug 2003