Documentation
¶
Index ¶
- type FileSystem
- type MemoryFileSystem
- func (fs *MemoryFileSystem) GetAllFiles() map[string][]byte
- func (fs *MemoryFileSystem) Join(elem ...string) string
- func (fs *MemoryFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (fs *MemoryFileSystem) ReadDir(path string) ([]os.DirEntry, error)
- func (fs *MemoryFileSystem) ReadFile(path string) ([]byte, error)
- func (fs *MemoryFileSystem) Remove(path string) error
- func (fs *MemoryFileSystem) Reset()
- func (fs *MemoryFileSystem) Stat(path string) (os.FileInfo, error)
- func (fs *MemoryFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error
- type OSFileSystem
- func (fs *OSFileSystem) Join(elem ...string) string
- func (fs *OSFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (fs *OSFileSystem) ReadDir(path string) ([]os.DirEntry, error)
- func (fs *OSFileSystem) ReadFile(path string) ([]byte, error)
- func (fs *OSFileSystem) Remove(path string) error
- func (fs *OSFileSystem) Stat(path string) (os.FileInfo, error)
- func (fs *OSFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface {
// WriteFile writes data to a file
WriteFile(path string, data []byte, perm os.FileMode) error
// ReadFile reads the entire file
ReadFile(path string) ([]byte, error)
// Stat returns file info
Stat(path string) (os.FileInfo, error)
// Remove removes a file
Remove(path string) error
// MkdirAll creates a directory path
MkdirAll(path string, perm os.FileMode) error
// Join joins path elements
Join(elem ...string) string
// ReadDir reads the named directory
ReadDir(path string) ([]os.DirEntry, error)
}
FileSystem defines the interface for file system operations
type MemoryFileSystem ¶
type MemoryFileSystem struct {
// contains filtered or unexported fields
}
MemoryFileSystem implements FileSystem in memory
func NewMemoryFileSystem ¶
func NewMemoryFileSystem() *MemoryFileSystem
func (*MemoryFileSystem) GetAllFiles ¶
func (fs *MemoryFileSystem) GetAllFiles() map[string][]byte
GetAllFiles returns all files in the memory file system (for debugging)
func (*MemoryFileSystem) Join ¶
func (fs *MemoryFileSystem) Join(elem ...string) string
func (*MemoryFileSystem) MkdirAll ¶
func (fs *MemoryFileSystem) MkdirAll(path string, perm os.FileMode) error
func (*MemoryFileSystem) ReadDir ¶ added in v1.5.3
func (fs *MemoryFileSystem) ReadDir(path string) ([]os.DirEntry, error)
func (*MemoryFileSystem) ReadFile ¶
func (fs *MemoryFileSystem) ReadFile(path string) ([]byte, error)
func (*MemoryFileSystem) Remove ¶
func (fs *MemoryFileSystem) Remove(path string) error
func (*MemoryFileSystem) Reset ¶
func (fs *MemoryFileSystem) Reset()
Reset clears all files and directories in the memory file system
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements FileSystem using real OS operations
func NewOSFileSystem ¶
func NewOSFileSystem() *OSFileSystem
func (*OSFileSystem) Join ¶
func (fs *OSFileSystem) Join(elem ...string) string
func (*OSFileSystem) MkdirAll ¶
func (fs *OSFileSystem) MkdirAll(path string, perm os.FileMode) error
func (*OSFileSystem) ReadDir ¶ added in v1.5.3
func (fs *OSFileSystem) ReadDir(path string) ([]os.DirEntry, error)
func (*OSFileSystem) Remove ¶
func (fs *OSFileSystem) Remove(path string) error
Click to show internal directories.
Click to hide internal directories.