@@ -4037,7 +4037,8 @@ def _check_all_upload_parts(self, bucket, key, uploadid, local_path, parts_num,
40374037 already_exist_parts [part_num ] = part ['ETag' ]
40384038 return True
40394039
4040- def download_file (self , Bucket , Key , DestFilePath , PartSize = 20 , MAXThread = 5 , EnableCRC = False , progress_callback = None , DumpRecordDir = None , KeySimplifyCheck = True , DisableTempDestFilePath = False , ** Kwargs ):
4040+ def download_file (self , Bucket , Key , DestFilePath , PartSize = 20 , MAXThread = 5 , EnableCRC = False , progress_callback = None ,
4041+ DumpRecordDir = None , KeySimplifyCheck = True , DisableTempDestFilePath = False , MaxPartCount = 10000 , ** Kwargs ):
40414042 """小于等于20MB的文件简单下载,大于20MB的文件使用续传下载
40424043
40434044 :param Bucket(string): 存储桶名称.
@@ -4049,10 +4050,11 @@ def download_file(self, Bucket, Key, DestFilePath, PartSize=20, MAXThread=5, Ena
40494050 :param DumpRecordDir(string): 指定保存断点信息的文件路径
40504051 :param KeySimplifyCheck(bool): 是否对Key进行posix路径语义归并检查
40514052 :param DisableTempDestFilePath(bool): 简单下载写入目标文件时,不使用临时文件
4053+ :param MaxPartCount(int): 分块下载的最大分块数
40524054 :param kwargs(dict): 设置请求headers.
40534055 """
40544056 logger .debug ("Start to download file, bucket: {0}, key: {1}, dest_filename: {2}, part_size: {3}MB,\
4055- max_thread: {4}" .format (Bucket , Key , DestFilePath , PartSize , MAXThread ))
4057+ max_thread: {4}, max_part_count: {5} " .format (Bucket , Key , DestFilePath , PartSize , MAXThread , MaxPartCount ))
40564058
40574059 head_headers = dict ()
40584060 # SSE-C对象在head时也要求传入加密头域
@@ -4075,7 +4077,7 @@ def download_file(self, Bucket, Key, DestFilePath, PartSize=20, MAXThread=5, Ena
40754077 if progress_callback :
40764078 callback = ProgressCallback (file_size , progress_callback )
40774079
4078- downloader = ResumableDownLoader (self , Bucket , Key , DestFilePath , object_info , PartSize , MAXThread , EnableCRC ,
4080+ downloader = ResumableDownLoader (self , Bucket , Key , DestFilePath , object_info , PartSize , MAXThread , MaxPartCount , EnableCRC ,
40794081 callback , DumpRecordDir , KeySimplifyCheck , ** Kwargs )
40804082 downloader .start ()
40814083
0 commit comments