Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- function usage()
- print("Usage: download <web adress> <file>")
- end
- if #args < 2 then
- usage()
- else
- if #args > 2 then
- usage()
- else
- local file = fs.open(args[2], "w")
- local url = "http://"..args[1]
- local curl = http.checkURL(url)
- if curl then
- print("Downloading...")
- se = http.get(url)
- file.write(se.readAll())
- file.close()
- se.close()
- print("Download Complete!")
- else
- print("Downloading...")
- os.sleep(2)
- print("Error Downloading: incorrect URL or no internet connection!")
- end
- end
- end
Add Comment
Please, Sign In to add comment