download_file

S3.Object.download_file(Filename, ExtraArgs=None, Callback=None, Config=None)

Download an S3 object to a file.

Usage:

import boto3
s3 = boto3.resource('s3')
s3.Object('mybucket', 'hello.txt').download_file('/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
  • 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.