Using gem curb (curl) to download a file

I realized that I could use RubyGem Curb to meet my needs of a file freeze on my computer. But I can’t figure out how to actually β€œtouch” a file. This is what I got so far

include 'rubygems' include 'curb' curl = Curl::Easy.new('http://wordpress.org/latest.zip') curl.perform 

I think I understand that perform actually loads the file. But how can I interact with the file after that? Where does it load?

Regards, Matthias

+1
source share
2 answers

Access to the file can be obtained using the body_str method.

 puts curl.body_str 
+3
source

Check out the docs at http://rdoc.info/gems/curb/0.7.15/ .

After perform , the content is, for example. curl.body_str .

+2
source

Source: https://habr.com/ru/post/1344673/


All Articles