local args = {...}
local remote = args[1]
local proto = "http://"
local url = "pegasus.pimpninjas.org/code/lua/"
if nil == string.find(remote, "/") then
remote = url .. remote .. "?"
end
if proto ~= string.sub(remote, 1, string.len(proto)) then
remote = proto .. remote
end
local req = http.get(remote)
if nil == req then
error("failed")
end
file = string.gsub(remote, ".*/([^?]*).*", "%1")
local fh = fs.open(shell.dir() .. "/" .. file, "w")
fh.write(req.readAll())
fh.close()
req.close()
print("Read " .. file .. ".")