-
Notifications
You must be signed in to change notification settings - Fork 128
add resumable download file #122
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
ut/test.py
Outdated
@@ -1164,6 +1164,10 @@ def _test_get_object_sensitive_content_recognition(): | |||
print(response) | |||
assert response | |||
|
|||
def test_download_file(): | |||
"""测试断点续传下载接口""" | |||
client.download_file(test_bucket, test_object, 'test_download_file.local') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ut建议加上md5校验,确保下载的文件的正确性
qcloud_cos/cos_client.py
Outdated
@@ -2942,6 +2943,30 @@ def _check_all_upload_parts(self, bucket, key, uploadid, local_path, parts_num, | |||
already_exist_parts[part_num] = part['ETag'] | |||
return True | |||
|
|||
def download_file(self, Bucket, Key, DestFilePath, PartSize=20, MAZThread=5, EnableCRC=False, **Kwargs): | |||
"""小于等于20MB的文件简单上传,大于20MB的文件使用分块上传 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注释不对
qcloud_cos/cos_client.py
Outdated
:param key(string): 分块上传路径名. | ||
:param LocalFilePath(string): 本地文件路径名. | ||
:param PartSize(int): 分块的大小设置,单位为MB. | ||
:param MAXThread(int): 并发上传的最大线程数. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
qcloud_cos/resumable_downloader.py
Outdated
pool.wait_completion() | ||
result = pool.get_result() | ||
if not result['success_all']: | ||
raise CosClientError('some upload_part fail after max_retry, please upload_file again') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
LGTM |
No description provided.