Method: Remi::Extractor::SftpFile#download

Defined in:
lib/remi/extractor/sftp_file.rb

#download(to_download = matching_entries, local_folder: @local_folder, ntry: 3) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/remi/extractor/sftp_file.rb', line 48

def download(to_download = matching_entries, local_folder: @local_folder, ntry: 3)
  connection do |sftp|
    to_download.map do |entry|
      local_file = File.join(local_folder, entry.name)
      @logger.info "Downloading #{entry.name} to #{local_file}"
      retry_download(ntry) { sftp.download!(entry.name, local_file) }
      local_file
    end
  end
end