Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wget = function(option, url, ziel)
- if type(url) ~= "string" and type(ziel) ~= "string" then
- print("Benutzung:")
- print("wget [-f] <URL> <Ziel>")
- return
- end
- if http.checkURL(url) then
- if fs.exists(ziel) and option ~= "-f" then
- print("Ziel existiert bereit")
- return
- else
- print("Starte Download ... ")
- local timer = os.startTimer(30)
- http.request(url)
- while true do
- local event, _, data = os.pullEvent()
- if event == "http_success" then
- print("Download erfolgreich")
- local f = io.open(ziel, "w")
- f:write(data.readAll())
- f:close()
- data:close()
- print("Gespeichert unter " .. ziel)
- return true
- elseif event == "timer" then
- print("<Fehler> Zeitberschreitung")
- return
- elseif event == "http_failure" then
- print("<Fehler> Download")
- return
- end
- end
- end
- else
- print("<Fehler> URL")
- return
- end
- end
- wget("-f", "https://raw.githubusercontent.com/Nex4rius/Nex4rius-Programme/master/Stargate-Programm/stargate/Kontrollprogramm.lua", "/2")
Advertisement
Add Comment
Please, Sign In to add comment