Downloading files from an FTP server is easy if you know the filename and what type of file you’re trying to download. Net::FTP provides two useful methods to download files, getbinaryfile and gettextfile. Plain text files and binary files (such as images, sounds, or applications) are sent in a different way, so it’s essential you use the correct method. In most situations you’ll be aware ahead of time which technique is required. Here’s an example showing how to download a binary file from the official Ruby FTP server:

require 'net/ftp'
ftp ='')
ftp.passive = true