i want to download files which are in amazon s3. And i have used boto3 sdk and i want to know the different between download_file and download_fileobj in boto3?
Asked
Active
Viewed 1.2k times
1 Answers
5
From the documentation, it is clearly mentioned that:
download_file(Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None)
Download an S3 object to a file.
and
download_fileobj(Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None)
Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary.
One is file, the other one is file-like object with binary mode.
-
2Let's give the OP the benefit of the doubt and assume they read this much. I think the info in the docs arguably still begs the question: What, exactly, is a "file-like object"? – Owen Oct 17 '22 at 16:21
-
1Ahh, "file-like object" is just a file object. See https://stackoverflow.com/a/58861402/310441 – Owen Oct 17 '22 at 16:31