|
@@ -213,3 +213,15 @@ class AmazonS3Util:
|
|
|
s3.Object(target_bucket, target_key).copy_from(CopySource=copy_source, StorageClass=storage_class)
|
|
|
else:
|
|
|
s3.Object(target_bucket, target_key).copy_from(CopySource=copy_source)
|
|
|
+
|
|
|
+ def get_object_size(self,bucket_name, object_key):
|
|
|
+ """
|
|
|
+ 获取存储桶中指定对象的大小
|
|
|
+
|
|
|
+ :param bucket_name: string,存储桶名称
|
|
|
+ :param object_key: string,对象键名
|
|
|
+ :return: int,指定对象的大小,单位为字节
|
|
|
+ """
|
|
|
+ s3 = self.session_conn
|
|
|
+ obj = s3.Object(bucket_name, object_key)
|
|
|
+ return obj.content_length
|