A
Alex Dj
I'm wondering is there any way to do interrupt file download and then
resume it from the same spot?
The way I download file:
Net::HTTP.start("server.com") { |http|
response = http.request_get('/some/path') {|response|
file_length = response['Content-Length']
File.open('video.avi', 'w') {|f|
response.read_body do |str| # read body now
puts str.length
f.write str
end
}
}
}
I'm not using open-url as I found that open() method first downloads
whole file and then starts to write it. Not for me....
Cheers Alex
resume it from the same spot?
The way I download file:
Net::HTTP.start("server.com") { |http|
response = http.request_get('/some/path') {|response|
file_length = response['Content-Length']
File.open('video.avi', 'w') {|f|
response.read_body do |str| # read body now
puts str.length
f.write str
end
}
}
}
I'm not using open-url as I found that open() method first downloads
whole file and then starts to write it. Not for me....
Cheers Alex