Mega Code Archive

 
Categories / Ruby / Network
 

Prints a string to the screen whenever another 100 kilobytes of the file have been downloaded

require 'net/ftp' ftp = Net::FTP.new('ftp.ruby-lang.org') ftp.passive = true ftp.login ftp.chdir('/pub/ruby/1.8') ftp.getbinaryfile('stable-snapshot.tar.gz', 'local-filename', 102400) do |blk|   puts "A 100KB block of the file has been downloaded" end ftp.close