From 2445175248cd96047bfceb30e443d017d3589ed4 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Mon, 27 May 2024 18:03:31 +0200 Subject: [PATCH] Fix wget using obsolete file and HTTP Lua methods Signed-off-by: Alessandro Proto --- Capy64/Assets/Lua/CapyOS/sys/bin/wget.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Capy64/Assets/Lua/CapyOS/sys/bin/wget.lua b/Capy64/Assets/Lua/CapyOS/sys/bin/wget.lua index 0933652..8a3c7c1 100644 --- a/Capy64/Assets/Lua/CapyOS/sys/bin/wget.lua +++ b/Capy64/Assets/Lua/CapyOS/sys/bin/wget.lua @@ -19,6 +19,8 @@ if not http.checkURL(args[1]) then error("Invalid URL", 0) end +print("Connecting...") + local response, err = http.get(args[1], nil, { binary = true, }) @@ -27,8 +29,8 @@ if not response then end local file = fs.open(outputPath, "wb") -file:write(response:readAll()) +file:write(response.content:read("a")) file:close() -response:close() +response.content:close() -print("File written to " .. outputPath) +print("Downloaded to " .. outputPath)