L
Lars Haugseth
I'm working on a script where I want to download large files off a remote
web server and store on a local filesystem.
At the moment I'm using code like this:
require 'open-uri'
open(filename, 'w') do |file|
file.write(open(remote_url).read)
end
I assume this will read the complete content of the remote file into
memory before writing it to the local file. If that assumption is
correct, what is the best/easiest way to do a buffered piecemeal
fetch/store? I've looked at the net/http library but haven't found
anything in there that looks relevant to this.
web server and store on a local filesystem.
At the moment I'm using code like this:
require 'open-uri'
open(filename, 'w') do |file|
file.write(open(remote_url).read)
end
I assume this will read the complete content of the remote file into
memory before writing it to the local file. If that assumption is
correct, what is the best/easiest way to do a buffered piecemeal
fetch/store? I've looked at the net/http library but haven't found
anything in there that looks relevant to this.