Documentation
¶
Overview ¶
Package memfs provides a billy filesystem backed by memory.
Filesystems created by this package are ephemeral and process-local: data is not persisted and disappears when the filesystem is discarded or the process exits. memfs is useful for tests and temporary data, but is not a persistence layer.
Index ¶
- func New(opts ...Option) billy.Filesystem
- type ByName
- type Memory
- func (fs *Memory) Capabilities() billy.Capability
- func (fs *Memory) Chmod(path string, mode gofs.FileMode) error
- func (fs *Memory) Create(filename string) (billy.File, error)
- func (fs *Memory) Join(elem ...string) string
- func (fs *Memory) Lstat(filename string) (os.FileInfo, error)
- func (fs *Memory) MkdirAll(path string, perm gofs.FileMode) error
- func (fs *Memory) Open(filename string) (billy.File, error)
- func (fs *Memory) OpenFile(filename string, flag int, perm gofs.FileMode) (billy.File, error)
- func (fs *Memory) ReadDir(path string) ([]gofs.DirEntry, error)
- func (fs *Memory) Readlink(link string) (string, error)
- func (fs *Memory) Remove(filename string) error
- func (fs *Memory) Rename(from, to string) error
- func (fs *Memory) Stat(filename string) (os.FileInfo, error)
- func (fs *Memory) Symlink(target, link string) error
- func (fs *Memory) TempFile(dir, prefix string) (billy.File, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...Option) billy.Filesystem
New returns a new Memory filesystem.
The returned value is a billy.Filesystem wrapped with the chroot helper, not the raw *Memory implementation.
Types ¶
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is a convenient filesystem based on memory files.
All filesystem data is loaded into memory. Users should ensure enough memory is available for the data they intend to store.
func (*Memory) Capabilities ¶
func (fs *Memory) Capabilities() billy.Capability
Capabilities implements the Capable interface.
func (*Memory) Join ¶
Falls back to Go's filepath.Join, which works differently depending on the OS where the code is being executed.