Fix wget using obsolete file and HTTP Lua methods

Signed-off-by: Alessandro Proto <alex@alexdevs.me>
This commit is contained in:
Alessandro Proto 2024-05-27 18:03:31 +02:00 committed by GitHub
parent c19fb78b1f
commit 2445175248
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,6 +19,8 @@ if not http.checkURL(args[1]) then
error("Invalid URL", 0) error("Invalid URL", 0)
end end
print("Connecting...")
local response, err = http.get(args[1], nil, { local response, err = http.get(args[1], nil, {
binary = true, binary = true,
}) })
@ -27,8 +29,8 @@ if not response then
end end
local file <close> = fs.open(outputPath, "wb") local file <close> = fs.open(outputPath, "wb")
file:write(response:readAll()) file:write(response.content:read("a"))
file:close() file:close()
response:close() response.content:close()
print("File written to " .. outputPath) print("Downloaded to " .. outputPath)