Initial Commit

main initial
Atlas Cove 1 year ago
commit 432da12f47

5
.gitignore vendored

@ -0,0 +1,5 @@
/luarocks
/lua
/lua_modules
/.luarocks
*.luac

@ -0,0 +1,19 @@
package = "snarf"
version = "dev-1"
source = {
url = nil
}
description = {
homepage = "https://github.com/Atlas48/snarf-lua",
license = "LGPL-3.0-or-later"
}
dependencies = {
"lua >= 5.1",
"luasocket >= 3.0rc1-2"
}
build = {
type = "builtin",
modules = {
snarf = "snarf.lua"
}
}

@ -0,0 +1,15 @@
local http=require "socket.http"
function snarf(s,l)
local body,code=http.request(s)
if code<=400 or code>=599 then
error(code)
elseif code<=300 or code>=399 then
print("Redirects not currently implemented")
error(code)
end
local f=assert(io.open(l))
f:write(body)
f:close()
end
return snarf
Loading…
Cancel
Save