tags:

views:

167

answers:

1

Using Mechanize with Ruby I get a certain file using agent.get('http://example.com/foo.torrent'), with FileUtils or otherwise, how do I save this file to my hard drive (for instance, in a directory wherefrom the script is running)?

P.S. class => WWW::Mechanize::File

+1  A: 

Well, WWW::Mechanize::File has a save_as instance method, so I suppose something like this might work:

agent.get('http://example.com/foo.torrent').save_as 'a_file_name'
DigitalRoss