class Aws::S3::FileUploader

@api private

def initialize(options = {})

Options Hash: (**options)
  • :multipart_threshold (Integer) --
  • :client (Client) --

Parameters:
  • options (Hash) --
def initialize(options = {})
  @options = options
  @client = options[:client] || Client.new
  @multipart_threshold = options[:multipart_threshold] ||
                         FIFTEEN_MEGABYTES
end

def open_file(source)

def open_file(source)
  if String === source || Pathname === source
    File.open(source, 'rb') { |file| yield(file) }
  else
    yield(source)
  end
end

def put_object(source, options)

def put_object(source, options)
  open_file(source) do |file|
    @client.put_object(options.merge(body: file))
  end
end

def upload(source, options = {})

Returns:
  • (void) -

Options Hash: (**options)
  • :key (required, String) -- The key for the object.
  • :bucket (required, String) -- The bucket to upload to.

Parameters:
  • source (String, Pathname, File, Tempfile) -- The file to upload.
def upload(source, options = {})
  if File.size(source) >= multipart_threshold
    MultipartFileUploader.new(@options).upload(source, options)
  else
    put_object(source, options)
  end
end