我明白,我可以使用RubyGem路邊滿足我的需要,將文件捲曲到我的電腦。但我不知道如何實際「觸摸」文件。這是我走到這一步,使用寶石路邊(捲曲)下載文件
include 'rubygems'
include 'curb'
curl = Curl::Easy.new('http://wordpress.org/latest.zip')
curl.perform
我想我明白,其實perform
下載文件。但是,我怎樣才能與文件進行交互?它在哪裏下載?
問候, 馬蒂亞斯
我明白,我可以使用RubyGem路邊滿足我的需要,將文件捲曲到我的電腦。但我不知道如何實際「觸摸」文件。這是我走到這一步,使用寶石路邊(捲曲)下載文件
include 'rubygems'
include 'curb'
curl = Curl::Easy.new('http://wordpress.org/latest.zip')
curl.perform
我想我明白,其實perform
下載文件。但是,我怎樣才能與文件進行交互?它在哪裏下載?
問候, 馬蒂亞斯
該文件可以通過body_str方法訪問。的
puts curl.body_str
檢查在http://rdoc.info/gems/curb/0.7.15/的文檔。
在perform
之後,內容處於例如, curl.body_str
。
可能重複(http://stackoverflow.com/questions/5386159/download-a-zip-file-through-nethttp) – 2011-03-22 05:35:41