Method: CarrierWave::Storage::Fog::File#read

Defined in:
lib/carrierwave/storage/fog.rb

#readObject

Read content of file from service

Returns

String

contents of file



289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/carrierwave/storage/fog.rb', line 289

def read
  file_body = file&.body

  return if file_body.nil?
  return file_body unless file_body.is_a?(::File)

  # Fog::Storage::XXX::File#body could return the source file which was uploaded to the remote server.
  return read_source_file if ::File.exist?(file_body.path)

  # If the source file doesn't exist, the remote content is read
  @file = nil
  file.body
end