Documentation
¶
Index ¶
- Variables
- func Exclude(fsys fs.FS, fn func(path string) bool) fs.FS
- func MarshalJSON(path string, file fs.File) ([]byte, error)
- func Merge(fileSystems ...fs.FS) *mergedFS
- func Mount(dir string, fsys fs.FS) fs.FS
- func Print(fsys fs.FS, subpaths ...string) (string, error)
- func Sync(from fs.FS, toDir string, subpaths ...string) error
- func SyncFS(from fs.FS, to FS, subpaths ...string) error
- func To(f *File) fs.File
- func UnmarshalJSON(file []byte) (fs.File, error)
- func Write(fsys fs.FS, toDir string, subpaths ...string) error
- func WriteFS(from fs.FS, to FS, subpaths ...string) error
- type DirEntry
- type FS
- type File
- func (f *File) Embed() string
- func (f *File) Entry() *DirEntry
- func (f *File) Hash(h hash.Hash) []byte
- func (f *File) Info() (fs.FileInfo, error)
- func (f *File) IsDir() bool
- func (f *File) Name() string
- func (f *File) Stamp() (stamp string, err error)
- func (f *File) Type() fs.FileMode
- func (f *File) Write(p []byte) (int, error)
- func (f *File) WriteString(s string) (int, error)
- type List
- func (fsys *List) MkdirAll(path string, perm fs.FileMode) error
- func (fsys List) Open(path string) (fs.File, error)
- func (fsys List) OpenFile(path string, flag int, perm fs.FileMode) (RWFile, error)
- func (fsys *List) RemoveAll(path string) error
- func (fsys *List) WriteFile(path string, data []byte, perm fs.FileMode) error
- type Map
- type OS
- func (dir OS) MkdirAll(path string, perm fs.FileMode) error
- func (dir OS) Open(name string) (fs.File, error)
- func (dir OS) OpenFile(name string, flag int, perm fs.FileMode) (RWFile, error)
- func (dir OS) ReadDir(name string) ([]fs.DirEntry, error)
- func (dir OS) RemoveAll(path string) error
- func (dir OS) WriteFile(name string, data []byte, perm fs.FileMode) error
- type RWFile
- type Tree
- func (t Tree) MkdirAll(path string, perm fs.FileMode) error
- func (fsys Tree) Open(path string) (fs.File, error)
- func (fsys Tree) OpenFile(path string, flag int, perm fs.FileMode) (RWFile, error)
- func (t Tree) RemoveAll(path string) error
- func (t Tree) WriteFile(path string, data []byte, perm fs.FileMode) error
Constants ¶
This section is empty.
Variables ¶
var Now = func() time.Time { return time.Now() }
Now may be overridden for testing purposes
Functions ¶
func Merge ¶ added in v0.0.7
Merge the filesystems together. When there are conflicts, the earlier filesystem has priority.
Types ¶
type DirEntry ¶
type FS ¶
type FS interface { fs.FS OpenFile(name string, flag int, perm fs.FileMode) (RWFile, error) MkdirAll(path string, perm fs.FileMode) error WriteFile(name string, data []byte, perm fs.FileMode) error RemoveAll(path string) error }
FS is a virtual filesystem interface. It extends the fs.FS interface with methods for creating and removing files and directories.
type File ¶
func (*File) Embed ¶
Embed as a string literal. https://github.com/go-bindata/go-bindata/blob/26949cc13d95310ffcc491c325da869a5aafce8f/stringwriter.go#L18-L36
type List ¶
type List []*File
List is meant to be a simple list of files. It's not a tree of files and you can't walk it. Use Tree if you need a more capable filesystem. This filesytem is not safe for concurrent use.
type OS ¶
type OS string
OS creates a new OS filesystem rooted at the given directory. TODO: create an os_windows for opening on multiple drives with the same API: https://github.com/golang/go/issues/44279#issuecomment-955766528
type RWFile ¶ added in v0.0.11
type RWFile interface { fs.File io.WriteCloser }
RWFile is a virtual file interface. It extends fs.FS to support reading and writing files.