Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fs_http = {
- isReadOnly = function() return true end,
- exists = function(self, path)
- return http.get(self.base .. path:sub(1)) ~= nil
- end,
- open = function(self, path, mode)
- assert(mode == "r", "HTTP FS only supports text reading!")
- return http.get(self.base .. path:sub(1))
- end,
- list = function(self, path) return {} end,
- getDrive = function(self) return self.base end,
- }
- vfs.registerFS("http", function(mp, opts)
- local t = {base = opts.base}
- setmetatable(t, {__index = fs_http})
- return t
- end)
- --vfs.unmount("/web/")
- --vfs.mount("/web/", "http", {base="http://en.wikipedia.org/wiki/"})
Advertisement
Add Comment
Please, Sign In to add comment