S3 / Client / download_file

download_file#

S3.Client.download_file(Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None)#

Download an S3 object to a file.

Usage:

import boto3
s3 = boto3.resource('s3')
s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt')

Similar behavior as S3Transfer’s download_file() method, except that parameters are capitalized. Detailed examples can be found at S3Transfer’s Usage.

Parameters:
  • Bucket (str) – The name of the bucket to download from.

  • Key (str) – The name of the key to download from.

  • Filename (str) – The path to the file to download to.

  • ExtraArgs (dict) – Extra arguments that may be passed to the client operation. For allowed download arguments see boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS.

  • Callback (function) – A method which takes a number of bytes transferred to be periodically called during the download.

  • Config (boto3.s3.transfer.TransferConfig) – The transfer configuration to be used when performing the transfer.