DabDaddy6223

update_git

Sep 28th, 2026 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. URL = "https://raw.githubusercontent.com/dabusmc/CARA/refs/heads/main/"
  2. FILE_NAME = ""
  3.  
  4. function download(path, destination)
  5.     local allowed, reason = http.checkURL(path)
  6.     if not allowed then
  7.         print("URL not allowed for " .. path .. ": " .. reason)
  8.         return false
  9.     end
  10.  
  11.     local response, err = http.get(path)
  12.     if not response then
  13.         print("Download failed: " .. err)
  14.         return false
  15.     end
  16.  
  17.     local file = fs.open(destination, "w")
  18.     if file == nil then
  19.         print("Failed to open file " .. destination)
  20.         response.close()
  21.         return false
  22.     end
  23.  
  24.     file.write(response.readAll())
  25.     file.close()
  26.  
  27.     response.close()
  28.     return true
  29. end
  30.  
  31. function main()
  32.     if fs.exists(FILE_NAME) then
  33.         fs.delete(FILE_NAME)
  34.     end
  35.  
  36.     local path = URL .. "?cache_bust=" .. os.epoch("utc")
  37.     download(path, FILE_NAME)
  38. end
  39.  
  40. main()
Advertisement
Add Comment
Please, Sign In to add comment