Method: FileConvert::Bucket#download

Defined in:
lib/file_convert/bucket.rb

#download(key) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/file_convert/bucket.rb', line 14

def download(key)
  temp_file = Converter.get_a_temp_file key
  file_with_key = @bucket[key]
  raise "There is no file with the key [#{key}]" if file_with_key.nil?
  File.open(temp_file, 'w') { |file| file.write(file_with_key.value) }
  temp_file
end