feat: Adds progress bar to cloud storage downloads (#13650)

This commit is contained in:
Linus045
2025-06-19 10:15:40 +02:00
committed by GitHub
parent e9e2de27c5
commit 3f19a2a05e
8 changed files with 246 additions and 21 deletions

View File

@@ -162,13 +162,17 @@ function WebDavApi:listFolder(address, user, pass, folder_path, folder_mode)
return webdav_list
end
function WebDavApi:downloadFile(file_url, user, pass, local_path)
function WebDavApi:downloadFile(file_url, user, pass, local_path, progress_callback)
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
logger.dbg("WebDavApi: downloading file: ", file_url)
local code, headers, status = socket.skip(1, http.request{
local handle = ltn12.sink.file(io.open(local_path, "w"))
handle = socketutil.chainSinkWithProgressCallback(handle, progress_callback)
local code, headers, status = socket.skip(1, http.request {
url = file_url,
method = "GET",
sink = ltn12.sink.file(io.open(local_path, "w")),
sink = handle,
user = user,
password = pass,
})