class Aws::S3::FileDownloader

def download(destination, options = {})

def download(destination, options = {})
  @path = destination
  @mode = options[:mode] || "auto"
  @thread_count = options[:thread_count] || THREAD_COUNT
  @chunk_size = options[:chunk_size]
  @bucket = options[:bucket]
  @key = options[:key]
  case @mode
  when "auto" then multipart_download
  when "single_request" then single_request
  when "get_range"
    if @chunk_size
      resp = @client.head_object(bucket: @bucket, key: @key)
      multithreaded_get_by_ranges(construct_chunks(resp.content_length))
    else
      msg = "In :get_range mode, :chunk_size must be provided"
      raise ArgumentError, msg
    end
  else
    msg = "Invalid mode #{@mode} provided, "\
      "mode should be :single_request, :get_range or :auto"
    raise ArgumentError, msg
  end
end