Class: Aws::S3::FileDownloader Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-s3/file_downloader.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Defined Under Namespace

Classes: MultipartProgress, Part, PartList

Constant Summary collapse

MIN_CHUNK_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

5 * 1024 * 1024
MAX_PARTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

10_000
HEAD_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

Set.new(Client.api.operation(:head_object).input.shape.member_names)
GET_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

API:

  • private

Set.new(Client.api.operation(:get_object).input.shape.member_names)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FileDownloader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FileDownloader.

API:

  • private



16
17
18
19
# File 'lib/aws-sdk-s3/file_downloader.rb', line 16

def initialize(options = {})
  @client = options[:client] || Client.new
  @executor = options[:executor]
end

Instance Attribute Details

#clientClient (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



22
23
24
# File 'lib/aws-sdk-s3/file_downloader.rb', line 22

def client
  @client
end

Instance Method Details

#download(destination, options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/aws-sdk-s3/file_downloader.rb', line 24

def download(destination, options = {})
  validate_destination!(destination)
  opts = build_download_opts(destination, options)
  validate_opts!(opts)

  Aws::Plugins::UserAgent.metric('S3_TRANSFER') do
    case opts[:mode]
    when 'auto' then multipart_download(opts)
    when 'single_request' then single_request(opts)
    when 'get_range' then range_request(opts)
    end
  end
  File.rename(opts[:temp_path], destination) if opts[:temp_path]
ensure
  cleanup_temp_file(opts)
end