Documentation
¶
Overview ¶
Package fs provides filesystem abstractions for mappa.
Index ¶
- type FileSystem
- type OSFileSystem
- func (f *OSFileSystem) Exists(path string) bool
- func (f *OSFileSystem) MkdirAll(path string, perm fs.FileMode) error
- func (f *OSFileSystem) Open(name string) (fs.File, error)
- func (f *OSFileSystem) ReadDir(name string) ([]fs.DirEntry, error)
- func (f *OSFileSystem) ReadFile(name string) ([]byte, error)
- func (f *OSFileSystem) Remove(name string) error
- func (f *OSFileSystem) Stat(name string) (fs.FileInfo, error)
- func (f *OSFileSystem) TempDir() string
- func (f *OSFileSystem) WriteFile(name string, data []byte, perm fs.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem interface {
// File operations
WriteFile(name string, data []byte, perm fs.FileMode) error
ReadFile(name string) ([]byte, error)
Remove(name string) error
// Directory operations
MkdirAll(path string, perm fs.FileMode) error
ReadDir(name string) ([]fs.DirEntry, error)
TempDir() string
// File system queries
Stat(name string) (fs.FileInfo, error)
Exists(path string) bool
// fs.FS compatibility - allows use with fs.WalkDir
Open(name string) (fs.File, error)
}
FileSystem provides an abstraction over filesystem operations. This interface is congruent with bennypowers.dev/cem/internal/platform.FileSystem to enable duck typing compatibility.
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements FileSystem using the standard os package.
func NewOSFileSystem ¶
func NewOSFileSystem() *OSFileSystem
NewOSFileSystem creates a new filesystem that uses the standard os package.
func (*OSFileSystem) Exists ¶
func (f *OSFileSystem) Exists(path string) bool
func (*OSFileSystem) MkdirAll ¶
func (f *OSFileSystem) MkdirAll(path string, perm fs.FileMode) error
func (*OSFileSystem) Remove ¶
func (f *OSFileSystem) Remove(name string) error
func (*OSFileSystem) TempDir ¶
func (f *OSFileSystem) TempDir() string
Click to show internal directories.
Click to hide internal directories.