I'd like to set --limit-rate
option for downloads done by Curb gem (ruby interface to curl).
In curl:
curl --limit-rate 10K http://server/large_file.rar
For downloads by Curb I have this code (plus progressbar, but that's not relevant to this question):
require 'rubygems'
require 'curb'
request = 'http://server/large_file.rar'
filename = 'large_file.rar'
f = open(filename, 'wb')
c = Curl::Easy.new(request) do |curl|
curl.on_body { |d| f << d; d.length }
end
c.perform
f.close
How do I set --limit-rate
option in this script? As long as I can tell, there's no easy way (I've already read rdoc and done some googling).