简体   繁体   English

如何使用transfer.upload_file()将md5校验和作为参数传递?

[英]how to pass md5 checksum as a parameter using transfer.upload_file()?

I want to pass the precalculated md5 checksum of a file as a parameter[Boto3], so that s3 checks against its own calculated md5/etag and discards if the md5 doesn't match. 我想将文件的预先计算的md5校验和作为参数传递[Boto3],以便s3对照自己计算的md5 / etag进行检查,如果md5不匹配,则将其丢弃。 (I do know that in multipart etag is not md5). (我知道在epart中不是md5)。 Is there a way to do it with(s3transfer) transfer.upload_file()? 有没有办法用(s3transfer)transfer.upload_file()吗? Or any other way to do that? 还是其他方式可以做到这一点? Please point me in right direction. 请指出正确的方向。 Thanks 谢谢

You can only store the md5 into metadata and use it as verification as describe here , to use md5 as verification , it is only possible using put_object 您只能将md5存储到元数据中,并按此处所述将其用作验证,要使用md5进行验证,则只能使用put_object

s3 tranfer allow you to save the metadata but without verification ability . s3 tranfer允许您保存元数据,但是没有验证功能。

transfer.upload_file('/tmp/myfile', 'bucket', 'key',
                     extra_args={'Metadata': {'a': 'b', 'c': 'd'}})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM