Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Copyright by Kilobyte/Stiepen 2012
- This is a quick WGET for ComputerCraft i made.
- if it crashes, make sure HTTP api is enabled.
- --]]
- local tArgs = {...}
- function main()
- local h = http.get(tArgs[1])
- if not h then
- printError("HTTP ERROR")
- return
- end
- local path = shell.resolve(tArgs[2])
- if fs.exists(path) then
- printError("File already exists")
- return
- end
- local dir = fs.combine(path, "..")
- if not fs.exists(dir) then
- fs.makeDir(dir)
- end
- local f = fs.open(path, "w")
- f.write(h.readAll())
- f.close()
- print("Done.")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement