From a396ab67ca9002582ddbf20c4d6eb2b9c18f5b55 Mon Sep 17 00:00:00 2001 From: hkc Date: Mon, 18 Dec 2023 18:26:51 +0300 Subject: [PATCH] Small tweaks --- gitea-clone.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gitea-clone.lua b/gitea-clone.lua index 34a0ebb..2e85908 100644 --- a/gitea-clone.lua +++ b/gitea-clone.lua @@ -46,9 +46,10 @@ local function downloadFile(url, path) local length = tonumber(headers["Content-Length"]) or 1 local written = 0 + local i = 0 local _, y = term.getCursorPos() while true do - local chunk = rq.read(1) + local chunk = rq.read(100) if not chunk then break end fp:write(chunk) written = written + #chunk @@ -59,6 +60,10 @@ local function downloadFile(url, path) local w = math.min(25, math.floor(written * 25 / length)) term.write("["..string.rep("=", w)..string.rep(" ", 25-w).."] ") term.write(string.format("%7.3f%% %s", 100 * written / length, path)) + i = i + 1 + if (i % 20) == 0 then + sleep(0.1) + end end fp:close() print()