使用boto3将文件上传到S3时,file_upload()和put_object()有什么区别? [英] What is the Difference between file_upload() and put_object() when uploading files to S3 using boto3
问题描述
我正在使用boto3并尝试上传文件.如果有人解释 boto3 中file_upload()
和put_object()
s3存储桶方法的确切区别,这将很有帮助?
- 性能上有区别吗?
- 这些人之中有谁在后台处理分段上传功能吗?
- 两者的最佳用例是什么?
upload_file
方法由S3传输管理器处理,这意味着它会在必要时为您自动处理幕后分段上传.>
put_object
方法直接映射到低级S3 API请求.它不会为您处理分段上传.它将尝试在一个请求中发送整个正文.
I'm using boto3 and trying to upload files. It will be helpful if anyone will explain exact difference between file_upload()
and put_object()
s3 bucket methods in boto3 ?
- Is there any performance difference?
- Does anyone among these handles multipart upload feature in behind the scenes?
- What are the best use cases for both?
The upload_file
method is handled by the S3 Transfer Manager, this means that it will automatically handle multipart uploads behind the scenes for you, if necessary.
The put_object
method maps directly to the low-level S3 API request. It does not handle multipart uploads for you. It will attempt to send the entire body in one request.
这篇关于使用boto3将文件上传到S3时,file_upload()和put_object()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!