0

Looking at this question: Reading Remote MP3 File's ID3 Tags using Java

It looks like it's possible to download just the tail end of a file. At least, HTTP supports it.

There is also: How to download via HTTP only piece of big file with ruby which relates to downloading only the beginning of a file.

Using Ruby, I'd like to download just the last pieces of a remote file. All I have is a URL.

Community
  • 1
  • 1
Jordan Warbelow-Feldstein
  • 10,510
  • 12
  • 48
  • 79
  • this works nicely for doing partial downloads starting at the beginning of a file -- but please note that this doesn't seem to work for seeking to the end of the file and starting the download there.. if you try this in irb, you will see that the size of response.body.size is shown as the full file size(!) – Tilo Oct 09 '11 at 00:32
  • Not true. yi_H's answer works fine. – Jordan Warbelow-Feldstein Oct 09 '11 at 17:24

1 Answers1

2

You have create a range request (partial download), here is the info how to do it: How to make an HTTP GET with modified headers?

You'll need the size of the file, so you need another request to fetch only the headers to parse that info, preferably with a HEAD command (or a GET with Range: bytes=0-0).

Community
  • 1
  • 1
Karoly Horvath
  • 94,607
  • 11
  • 117
  • 176