Initial Commit

This commit is contained in:
Atlas Cove 2021-12-12 06:41:15 +00:00
commit 432da12f47
3 changed files with 39 additions and 0 deletions

5
.gitignore vendored Normal file
View File

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

19
snarf-dev-1.rockspec Normal file
View File

@ -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"
}
}

15
snarf.lua Normal file
View File

@ -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