fix progress step

This commit is contained in:
jxxghp
2025-08-24 16:33:44 +08:00
parent 2285befebb
commit 8fac8c5307
6 changed files with 17 additions and 16 deletions
+5 -8
View File
@@ -39,6 +39,9 @@ class SMB(StorageBase, metaclass=WeakSingleton):
"copy": "复制",
}
# 文件块大小,默认100MB
chunk_size = 100 * 1024 * 1024
def __init__(self):
super().__init__()
self._connected = False
@@ -433,12 +436,9 @@ class SMB(StorageBase, metaclass=WeakSingleton):
# 使用更高效的文件传输方式
with smbclient.open_file(smb_path, mode="rb") as src_file:
with open(local_path, "wb") as dst_file:
# 使用更大的缓冲区提高性能
buffer_size = 1024 * 1024 # 1MB
downloaded_size = 0
while True:
chunk = src_file.read(buffer_size)
chunk = src_file.read(self.chunk_size)
if not chunk:
break
dst_file.write(chunk)
@@ -483,12 +483,9 @@ class SMB(StorageBase, metaclass=WeakSingleton):
# 使用更高效的文件传输方式
with open(path, "rb") as src_file:
with smbclient.open_file(smb_path, mode="wb") as dst_file:
# 使用更大的缓冲区提高性能
buffer_size = 1024 * 1024 # 1MB
uploaded_size = 0
while True:
chunk = src_file.read(buffer_size)
chunk = src_file.read(self.chunk_size)
if not chunk:
break
dst_file.write(chunk)