Documentation
¶
Index ¶
- type PreprocessingEmbed
- func (c *PreprocessingEmbed) Base(name string) string
- func (c *PreprocessingEmbed) Delete(name string) error
- func (c *PreprocessingEmbed) Exists(name string) (bool, error)
- func (c *PreprocessingEmbed) Ext(name string) string
- func (c *PreprocessingEmbed) ExtraInfo(name string) map[string]any
- func (c *PreprocessingEmbed) GetHash() (string, error)
- func (c *PreprocessingEmbed) GetSeparators() rune
- func (c *PreprocessingEmbed) Getwd() (string, error)
- func (c *PreprocessingEmbed) InvalidateHash()
- func (c *PreprocessingEmbed) IsAbs(name string) bool
- func (c *PreprocessingEmbed) Join(elem ...string) string
- func (c *PreprocessingEmbed) MkdirAll(path string, perm os.FileMode) error
- func (c *PreprocessingEmbed) Open(name string) (fs.File, error)
- func (c *PreprocessingEmbed) OpenFile(name string, flag int, perm os.FileMode) (fs.File, error)
- func (c *PreprocessingEmbed) PathSplit(name string) (string, string)
- func (c *PreprocessingEmbed) ReadDir(dirname string) ([]fs.DirEntry, error)
- func (c *PreprocessingEmbed) ReadFile(name string) ([]byte, error)
- func (c *PreprocessingEmbed) Rel(basepath, targpath string) (string, error)
- func (c *PreprocessingEmbed) Rename(oldname, newname string) error
- func (c *PreprocessingEmbed) Stat(name string) (fs.FileInfo, error)
- func (c *PreprocessingEmbed) WriteFile(name string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PreprocessingEmbed ¶
type PreprocessingEmbed struct {
*embed.FS
EnableCache bool
// contains filtered or unexported fields
}
PreprocessingEmbed is a simple tools to read file from embed.FS and gzip compress file only support ReadFile method, not support Open method
func NewEmptyPreprocessingEmbed ¶
func NewEmptyPreprocessingEmbed() *PreprocessingEmbed
func NewPreprocessingEmbed ¶
NewPreprocessingEmbed create a CompressFS instance fs is embed.FS instance, compressDirs is a map, key is virtual dir, value is compress file name
func (*PreprocessingEmbed) Base ¶
func (c *PreprocessingEmbed) Base(name string) string
func (*PreprocessingEmbed) Delete ¶
func (c *PreprocessingEmbed) Delete(name string) error
func (*PreprocessingEmbed) Ext ¶
func (c *PreprocessingEmbed) Ext(name string) string
func (*PreprocessingEmbed) ExtraInfo ¶
func (c *PreprocessingEmbed) ExtraInfo(name string) map[string]any
ExtraInfo returns extra information about the fs
func (*PreprocessingEmbed) GetHash ¶
func (c *PreprocessingEmbed) GetHash() (string, error)
GetHash 计算所有文件内容的哈希值,用于检测文件是否有变动 返回一个 SHA256 哈希字符串
func (*PreprocessingEmbed) GetSeparators ¶
func (c *PreprocessingEmbed) GetSeparators() rune
PathFileSystem methods
func (*PreprocessingEmbed) Getwd ¶
func (c *PreprocessingEmbed) Getwd() (string, error)
func (*PreprocessingEmbed) InvalidateHash ¶
func (c *PreprocessingEmbed) InvalidateHash()
InvalidateHash 清除缓存的哈希值,在文件可能发生变化后调用
func (*PreprocessingEmbed) IsAbs ¶
func (c *PreprocessingEmbed) IsAbs(name string) bool
func (*PreprocessingEmbed) Join ¶
func (c *PreprocessingEmbed) Join(elem ...string) string
func (*PreprocessingEmbed) MkdirAll ¶
func (c *PreprocessingEmbed) MkdirAll(path string, perm os.FileMode) error
func (*PreprocessingEmbed) Open ¶
func (c *PreprocessingEmbed) Open(name string) (fs.File, error)
Open opens the named file
func (*PreprocessingEmbed) OpenFile ¶
OpenFile opens the named file with specified flag (readonly for tar.gz)
func (*PreprocessingEmbed) PathSplit ¶
func (c *PreprocessingEmbed) PathSplit(name string) (string, string)
func (*PreprocessingEmbed) ReadDir ¶
func (c *PreprocessingEmbed) ReadDir(dirname string) ([]fs.DirEntry, error)
ReadDir reads the directory and returns directory entries
func (*PreprocessingEmbed) ReadFile ¶
func (c *PreprocessingEmbed) ReadFile(name string) ([]byte, error)
ReadFile override embed.FS.ReadFile, if file is compress file, return decompress data
func (*PreprocessingEmbed) Rel ¶
func (c *PreprocessingEmbed) Rel(basepath, targpath string) (string, error)
func (*PreprocessingEmbed) Rename ¶
func (c *PreprocessingEmbed) Rename(oldname, newname string) error
WriteFileSystem methods (read-only, return errors)