func FileServer(fs fs.ReadDirFS, options ...func(server *Server)) *Server {
	s := Server{
		fs:   fs,
		info: make(map[string]fileInfo),
		OnError: func(rw http.ResponseWriter, r *http.Request, err error) {
			http.Error(rw, "Internal Server Error", http.StatusInternalServerError)
		},
		Encodings: []Encoding{GzipEncoding()},
	}

	for _, o := range options {
		o(&s)
	}

	// Reading from "." is not expected to fail.
	if err := s.hashDir("."); err != nil {
		panic(err)
	}

	if s.EncodeOnInit {
		err := s.encodeFiles()
		if err != nil {
			panic(err)
		}
	}

	return &s
}
// FileServer creates an instance of Server from file system.
//
// Typically file system would be an embed.FS.
//
//   //go:embed *.png *.br
//	 var FS embed.FS
//
// Brotli support is optionally available with brotli.AddEncoding.
FileServer creates an instance of Server from file system.

Typically file system would be an embed.FS.

embed *.png *.br
var FS embed.FS

Brotli support is optionally available with brotli.AddEncoding.
// FileServer creates an instance of Server from file system . // // Typically file system would be an embed . FS . // // // go : embed * . png * . br // var FS embed . FS // // Brotli support is optionally available with brotli . AddEncoding .
func FileServer(fs fs.ReadDirFS, options ...func(server *Server)) *Server {
	s := Server{
		fs:   fs,
		info: make(map[string]fileInfo),
		OnError: func(rw http.ResponseWriter, r *http.Request, err error) {
			http.Error(rw, "Internal Server Error", http.StatusInternalServerError)
		},
		Encodings: []Encoding{GzipEncoding()},
	}
	for _, o := range options {
		o(&s)
	}
	if err := s.hashDir("."); err != nil {
		panic(err)
	}
	if s.EncodeOnInit {
		err := s.encodeFiles()
		if err != nil {
			panic(err)
		}
	}
	return &s
}
func FileServer ( fs fs . ReadDirFS , options ... func ( server * Server ) ) * Server { s := Server { fs : fs , info : make ( map [ string ] fileInfo ) , OnError : func ( rw http . ResponseWriter , r * http . Request , err error ) { http . Error ( rw , " " , http . StatusInternalServerError ) } , Encodings : [ ] Encoding { GzipEncoding ( ) } , } for _ , o := range options { o ( & s ) } if err := s . hashDir ( " " ) ; err != nil { panic ( err ) } if s . EncodeOnInit { err := s . encodeFiles ( ) if err != nil { panic ( err ) } } return & s }
FileServer creates an instance of Server from file system.
FileServer creates an instance of Server from file system .
// Reading from "." is not expected to fail.