Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL = "https://raw.githubusercontent.com/dabusmc/CARA/refs/heads/main/"
- FILE_NAME = ""
- function download(path, destination)
- local allowed, reason = http.checkURL(path)
- if not allowed then
- print("URL not allowed for " .. path .. ": " .. reason)
- return false
- end
- local response, err = http.get(path)
- if not response then
- print("Download failed: " .. err)
- return false
- end
- local file = fs.open(destination, "w")
- if file == nil then
- print("Failed to open file " .. destination)
- response.close()
- return false
- end
- file.write(response.readAll())
- file.close()
- response.close()
- return true
- end
- function main()
- if fs.exists(FILE_NAME) then
- fs.delete(FILE_NAME)
- end
- local path = URL .. "?cache_bust=" .. os.epoch("utc")
- download(path, FILE_NAME)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment