Using gem Curb (curl) to download file
I have understood that I could use the RubyGem Curb to fulfill my needs of curl'ing down a file to my computer. But I cannot figure out how to actually "touch" the file. This is what I have got so far
include 'rubyge开发者_开发百科ms'
include 'curb'
curl = Curl::Easy.new('http://wordpress.org/latest.zip')
curl.perform
I think I understand that perform
actually downloads the file. But how can I interact with the file afterwards? Where is it downloaded to?
Regards, Mattias
The file can be accessed with the body_str method.
puts curl.body_str
Check the docs at http://rdoc.info/gems/curb/0.7.15/.
After perform
, the content is in e.g. curl.body_str
.
精彩评论