generate functionWed, 01 Mar 2023

rails download remote file to temp file

def download_to_temp_file(url) tmp_file = Tempfile.new(url.split('/').last) tmp_file.binmode tmp_file.write open(url).read tmp_file.close tmp_file end

Questions about programming?Chat with your personal AI assistant