Jordan Warbelow-Feldstein
Jordan Warbelow-Feldstein

Reputation: 10748

Download the last parts of a file, using Ruby?

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.

Upvotes: 0

Views: 487

Answers (1)

Karoly Horvath
Karoly Horvath

Reputation: 96266

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).

Upvotes: 2

Related Questions