Documentation
¶
Index ¶
- func CopyFile(src, dst string) error
- type CachedFS
- func (cfs *CachedFS) ClearCache()
- func (cfs *CachedFS) Close() error
- func (cfs *CachedFS) Delete(ctx context.Context, path string) error
- func (cfs *CachedFS) DeleteAll(ctx context.Context, path string) error
- func (cfs *CachedFS) Exists(ctx context.Context, path string) (bool, error)
- func (cfs *CachedFS) InvalidateDirCache(path string)
- func (cfs *CachedFS) ListDir(ctx context.Context, path string) ([]*FileInfo, error)
- func (cfs *CachedFS) MkdirAll(ctx context.Context, path string, perm os.FileMode) error
- func (cfs *CachedFS) Move(ctx context.Context, src, dst string) error
- func (cfs *CachedFS) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (cfs *CachedFS) ReadFileLines(ctx context.Context, path string, from, to int) ([]string, error)
- func (cfs *CachedFS) Stat(ctx context.Context, path string) (*FileInfo, error)
- func (cfs *CachedFS) WriteFile(ctx context.Context, path string, data []byte) error
- type FileInfo
- type FileSystem
- type MockFS
- func (mfs *MockFS) Delete(ctx context.Context, path string) error
- func (mfs *MockFS) DeleteAll(ctx context.Context, path string) error
- func (mfs *MockFS) Exists(ctx context.Context, path string) (bool, error)
- func (mfs *MockFS) ListDir(ctx context.Context, path string) ([]*FileInfo, error)
- func (mfs *MockFS) MkdirAll(ctx context.Context, path string, perm os.FileMode) error
- func (mfs *MockFS) Move(ctx context.Context, src, dst string) error
- func (mfs *MockFS) ReadFile(ctx context.Context, path string) ([]byte, error)
- func (mfs *MockFS) ReadFileLines(ctx context.Context, path string, from, to int) ([]string, error)
- func (mfs *MockFS) Stat(ctx context.Context, path string) (*FileInfo, error)
- func (mfs *MockFS) WriteFile(ctx context.Context, path string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CachedFS ¶
type CachedFS struct {
// contains filtered or unexported fields
}
CachedFS is a filesystem implementation with directory listing cache
func NewCachedFS ¶
NewCachedFS creates a new cached filesystem with fsnotify
func (*CachedFS) ClearCache ¶
func (cfs *CachedFS) ClearCache()
ClearCache removes all entries from cache
func (*CachedFS) InvalidateDirCache ¶
InvalidateDirCache removes a directory from cache
func (*CachedFS) ReadFileLines ¶
type FileSystem ¶
type FileSystem interface {
// ReadFile reads the entire file
ReadFile(ctx context.Context, path string) ([]byte, error)
// ReadFileLines reads specific lines from a file
ReadFileLines(ctx context.Context, path string, from, to int) ([]string, error)
// WriteFile writes data to a file
WriteFile(ctx context.Context, path string, data []byte) error
// Stat returns file information
Stat(ctx context.Context, path string) (*FileInfo, error)
// ListDir lists directory contents
ListDir(ctx context.Context, path string) ([]*FileInfo, error)
// Exists checks if a file exists
Exists(ctx context.Context, path string) (bool, error)
// Delete removes a file or empty directory
Delete(ctx context.Context, path string) error
// DeleteAll removes a directory and all its contents recursively
DeleteAll(ctx context.Context, path string) error
// MkdirAll creates a directory and all parent directories
MkdirAll(ctx context.Context, path string, perm os.FileMode) error
// Move renames or moves a file or directory to a new path
Move(ctx context.Context, src, dst string) error
}
FileSystem is an abstraction over filesystem operations
Click to show internal directories.
Click to hide internal directories.