mirror of
https://github.com/gin-gonic/gin.git
synced 2025-04-06 03:57:46 +08:00
23 lines
363 B
Go
23 lines
363 B
Go
package fs
|
|
|
|
import (
|
|
"io/fs"
|
|
"net/http"
|
|
)
|
|
|
|
// FileSystem implements an [fs.FS].
|
|
type FileSystem struct {
|
|
http.FileSystem
|
|
}
|
|
|
|
// Open passes `Open` to the upstream implementation and return an [fs.File].
|
|
func (o FileSystem) Open(name string) (fs.File, error) {
|
|
f, err := o.FileSystem.Open(name)
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return fs.File(f), nil
|
|
}
|