Documentation ¶
Overview ¶
Package fs provides an interface over file system interactions. This allows for easy mocking in tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface { io.Closer io.Reader io.ReaderAt io.Seeker io.Writer io.WriterAt Stat() (os.FileInfo, error) }
File provides a mockable interface for os file operations
type FileInfo ¶
type FileInfo interface { Name() string // base name of the file Size() int64 // length in bytes for regular files; system-dependent for others Mode() os.FileMode // file mode bits ModTime() time.Time // modification time IsDir() bool // abbreviation for Mode().IsDir() Sys() interface{} // underlying data source (can return nil) }
FileInfo provides a mockable interface for file operations
type FileSystem ¶
type FileSystem interface { NewFile(fd uintptr, name string) File Create(name string) (File, error) Open(name string) (File, error) Stat(name string) (FileInfo, error) RemoveAll(name string) error MkdirAll(name string, mode FileMode) error ReadFile(filename string) ([]byte, error) WriteFile(filename string, data []byte, mode FileMode) error }
FileSystem provides a mockable abstraction over os file methods
func NewLocalFS ¶
func NewLocalFS() FileSystem
NewLocalFS creates a FileSystem interface that interacts with the local file system
Click to show internal directories.
Click to hide internal directories.