Skip to content

Instantly share code, notes, and snippets.

@bcackerman
bcackerman / File download on Heroku
Created August 17, 2016 20:51
Code to download a CSV file on Heroku (using Rails) and run a script on it
# I'm using smarter-csv gem to help parse the CSV
require 'net/ftp'
filename = 'filename-here.csv'
temp_file = Tempfile.new("download-#{filename}")
temp_file.binmode
import_options = {chunk_size: 10000, downcase_header: true, :row_sep => :auto, encoding: "UTF-8"}
size = 0
progress = 0