package ext import ( "io/fs" "github.com/valyala/fasthttp" ) type FileSystem interface { Open(name string) (fs.File, error) } func FileServer(rootFS FileSystem, rootPath string) fasthttp.RequestHandler { return func(r *fasthttp.RequestCtx) { path := r.UserValue("filepath").(string) r.SendFile(rootPath + path) } }