Using Mechanize with Ruby. I get a specific file using agent.get('http://example.com/foo.torrent'), with FileUtils or in another way, how to save this file to my hard drive (for example, in the directory where the script works)?
agent.get('http://example.com/foo.torrent')
PS class => WWW::Mechanize::File
class => WWW::Mechanize::File
Well, it WWW::Mechanize::Filehas an instance method save_as, so I assume something like this might work:
WWW::Mechanize::File
save_as
agent.get('http://example.com/foo.torrent').save_as 'a_file_name'
, Mechanize::File . Mechanize::Download, . , script ( ). , . :
Mechanize::File
Mechanize::Download
agent.pluggable_parser.default = Mechanize::Download agent.get( "http://example.com/foo.torrent}").save("path/to/a_file_name")
, , Stackoverflow.
Source: https://habr.com/ru/post/1725571/More articles:C ++ templates and the ambiguity problem - c ++How to call a web service using XDocument? - c #Скремблирующая система Память для строк, соответствующих регулярному выражению в Windows - memoryhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1725569/has-a-relationship-applies-to-inherited-members&usg=ALkJrhjNg8nE1olr9-KEIQhRkMCiSyb3bAJava reads utf-8 encoded file, character by character - javaSend and receive data over a noisy data stream - javaRuby # crypt string in C # and php - stringComputed columns: SQL or locally in the Entity Framework? - performanceJoining two tables using a double-valued column, master -lookup tables - sqlLinux distribution / version for Linux software release support - linuxAll Articles