Home > Blockchain >  BOTO3 S3 file copy blocking or non blocking?
BOTO3 S3 file copy blocking or non blocking?

Time:11-16

Is BOTO3 S3 file copy blocking or non blocking? Also can I add extra metadata to destination object during copy.

CodePudding user response:

It's blocking. I learned this not from the documentation, but by looking at the source code for TransferManager, which is what does the work.

If you want to provide new metadata for the destination, then use the ExtraArgs parameter. Be aware that the supported arguments are limited, and have different names than you might expect (eg, ContentType rather than Content-Type).

However, I don't recommend that you use copy(), because it works by downloading the file to your client and then uploading. This introduces delays, the possibility of errors, and potentially increased costs for data transfer.

Instead, if you're copying files on S3, use copy_object(). You'll still pay data transfer charges, but the copy will execute entirely within S3, so is much faster.

  • Related