Method: Paperclip::Storage::S3#copy_to_local_file

Defined in:
lib/paperclip/storage/s3.rb

#copy_to_local_file(style, local_dest_path) ⇒ Object



413
414
415
416
417
418
419
420
421
422
423
# File 'lib/paperclip/storage/s3.rb', line 413

def copy_to_local_file(style, local_dest_path)
  log("copying #{path(style)} to local file #{local_dest_path}")
  ::File.open(local_dest_path, 'wb') do |local_file|
    s3_object(style).get do |chunk|
      local_file.write(chunk)
    end
  end
rescue Aws::Errors::ServiceError => e
  warn("#{e} - cannot copy #{path(style)} to local file #{local_dest_path}")
  false
end