DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Peter has posted 12 posts at DZone. View Full User Profile

Using Rio From Ruby To Easily Save A Web Page To File

08.16.2006
| 8269 views |
  • submit to reddit
        Found at <a href="http://www.juretta.com/log/2006/08/13/ruby_net_http_and_open-uri/">http://www.juretta.com/log/2006/08/13/ruby_net_http_and_open-uri/</a>

# (sudo) gem install rio
require 'rubygems'
require 'rio'
# open an URI an copy the content into a file
rio('http://www.juretta.com/') > rio('juretta_index.html')

Cool syntax!    

Comments

Snippets Manager replied on Tue, 2006/11/14 - 8:44pm

I knew there must be an easy way to do this with ruby.