gpt4 book ai didi

web-services - 在 Amazon S3 上增长文件

转载 作者:行者123 更新时间:2023-12-04 05:48:32 27 4
gpt4 key购买 nike

是否可以在亚马逊 s3 上拥有不断增长的文件?

也就是说,我可以上传一个我在上传开始时不知道最终大小的文件。这样我就可以开始以指定的偏移量将更多数据写入文件。

例如一次写入 1000 字节,然后在下一次调用中继续写入偏移量为 1001 的文件,这样下一个写入的字节就是文件的 1001 字节。

最佳答案

Amazon S3确实允许您通过 Uploading Objects Using Multipart Upload API 执行此操作:

Multipart upload allows you to upload a single object as a set of parts. Each part is a contiguous portion of the object's data. You can upload these object parts independently and in any order. If transmission of any part fails, you can retransmit that part without affecting other parts. After all parts of your object are uploaded, Amazon S3 assembles these parts and creates the object. [...]



列出的优势之一正是针对您的用例,即 在知道最终对象大小之前开始上传 - 您可以在创建对象时上传它。

Using the REST API for Multipart Upload 提供此功能和所有 AWS SDKs以及第 3 方库,如 boto (一个为 Amazon Web Services 提供接口(interface)的 Python 包)也提供基于此 API 的分段上传支持。

关于web-services - 在 Amazon S3 上增长文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10376745/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com