Documentation ¶
Index ¶
- Variables
- type File
- func (f *File) Close() error
- func (f *File) IsDir() bool
- func (f *File) ModTime() time.Time
- func (f *File) Mode() os.FileMode
- func (f *File) Name() string
- func (f *File) Read(data []byte) (int, error)
- func (f *File) Readdir(count int) ([]os.FileInfo, error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Size() int64
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sys() interface{}
- type FileSystem
- func (fs *FileSystem) Exists(name string) bool
- func (fs *FileSystem) File(filename string) (*File, error)
- func (fs *FileSystem) Open(name string) (http.File, error)
- func (fs *FileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
- func (fs *FileSystem) ReadFile(filename string) ([]byte, error)
- func (fs *FileSystem) WithIgnoredPrefix(prefix string) (newFs *FileSystem)
- func (fs *FileSystem) WithPrefix(prefix string) (newFs *FileSystem)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileNotFound error when file is not found ErrFileNotFound = errors.New("specified file is not found") )
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Path string Data []byte FileMode os.FileMode ModifiedAt time.Time // contains filtered or unexported fields }
File file system model for each files
func NewFromFileInfo ¶
NewFromFileInfo return new file
type FileSystem ¶
type FileSystem struct { Dirs map[string][]string Files map[string]*File // contains filtered or unexported fields }
FileSystem exported to a generated asset file
func NewFS ¶
func NewFS(dirs map[string][]string, files map[string]*File) *FileSystem
NewFS return newFS FileSystem pointer
func (*FileSystem) Exists ¶
func (fs *FileSystem) Exists(name string) bool
Exists check whether file exists
func (*FileSystem) File ¶
func (fs *FileSystem) File(filename string) (*File, error)
File returns file struct
func (*FileSystem) Open ¶
func (fs *FileSystem) Open(name string) (http.File, error)
Open file from name
func (*FileSystem) ReadDir ¶
func (fs *FileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
ReadDir return all files in specified directory
func (*FileSystem) ReadFile ¶
func (fs *FileSystem) ReadFile(filename string) ([]byte, error)
ReadFile read file and return []byte like as ioutil.ReadFile
func (*FileSystem) WithIgnoredPrefix ¶ added in v1.0.2
func (fs *FileSystem) WithIgnoredPrefix(prefix string) (newFs *FileSystem)
IgnoredPrefix set FileSystem.pathPrefix and return FileSystem itself
func (*FileSystem) WithPrefix ¶
func (fs *FileSystem) WithPrefix(prefix string) (newFs *FileSystem)
WithPrefix set FileSystem.pathPrefix and return FileSystem itself
Click to show internal directories.
Click to hide internal directories.