feat: Initial commit

This commit is contained in:
engigu
2025-12-20 09:30:16 +08:00
commit 362237241e
189 changed files with 12035 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package static
import (
"embed"
"io/fs"
"net/http"
)
//go:embed dist/*
var distFS embed.FS
// GetFileSystem 返回嵌入的静态文件系统
func GetFileSystem() http.FileSystem {
subFS, err := fs.Sub(distFS, "dist")
if err != nil {
panic(err)
}
return http.FS(subFS)
}
// GetFS 返回嵌入的 fs.FS
func GetFS() fs.FS {
subFS, err := fs.Sub(distFS, "dist")
if err != nil {
panic(err)
}
return subFS
}
// ReadFile 读取嵌入的文件
func ReadFile(name string) ([]byte, error) {
return distFS.ReadFile("dist/" + name)
}