Documentation
¶
Index ¶
- func RootDir() string
- type MemFS
- func (fs MemFS) FileCount() int
- func (fs MemFS) FindWithPrefixAndSuffix(prefix, suffix string) ([]string, error)
- func (fs MemFS) MoveFile(oldPath, newPath string) error
- func (fs MemFS) Paths() []string
- func (fs MemFS) ReadFile(path string) (data []byte, err error)
- func (fs MemFS) RemoveFile(path string) ([]byte, error)
- func (fs MemFS) WriteFile(path string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemFS ¶
type MemFS struct {
// contains filtered or unexported fields
}
MemFS is a simple in-memory filesystem with a working directory. It's intended mainly for testing.
func (MemFS) FindWithPrefixAndSuffix ¶
FindWithPrefixAndSuffix returns all files whose path matches the given prefix and suffix, in no particular order. The prefix may be absolute or relative (to the working directory).
func (MemFS) MoveFile ¶
MoveFile moves the file at oldPath to newPath. oldPath and newPath may be either absolute or relative (to the working directory). If the file doesn't exist at oldPath, os.ErrNotExist is returned.
func (MemFS) ReadFile ¶
ReadFile returns the data of the file at the given path, which may be absolute or relative (to the working directory). If the file doesn't exist, os.ErrNotExist is returned.
func (MemFS) RemoveFile ¶
RemoveFile removes the file at the given path, which may be absolute or relative (to the working directory). The removed data is returned, or os.ErrNotExist if it doesn't exist.