Documentation
¶
Index ¶
- Constants
- type FileManager
- func (fm *FileManager) DeleteFileIfExists(filePath string) error
- func (fm *FileManager) Has(path string) (bool, error)
- func (fm *FileManager) ListFilesInDirectory(dir string, filterFunc func(entry os.DirEntry) bool) ([]os.FileInfo, error)
- func (fm *FileManager) ListFilesRecursively(dir string) ([]os.FileInfo, error)
- func (fm *FileManager) ReadFile(filePath string, output interface{}) error
- func (fm *FileManager) ReadUserInput() (string, error)
- func (fm *FileManager) RemoveFileOrDirectory(path string) error
- func (fm *FileManager) Rename(oldPath, newPath string) error
- func (fm *FileManager) WriteFile(filePath string, content interface{}) error
- func (fm *FileManager) WriteFileWithFunc(filePath string, contentFunc func() (interface{}, error)) error
- type FileManagerInterface
- type FileType
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
FileManager structure for managing file and directory content
func NewFileManager ¶
func NewFileManager() *FileManager
NewFileManager creates a new instance of FileManager
func (*FileManager) DeleteFileIfExists ¶
func (fm *FileManager) DeleteFileIfExists(filePath string) error
func (*FileManager) Has ¶
func (fm *FileManager) Has(path string) (bool, error)
Has checks if a file or directory exists at the specified path
func (*FileManager) ListFilesInDirectory ¶
func (fm *FileManager) ListFilesInDirectory(dir string, filterFunc func(entry os.DirEntry) bool) ([]os.FileInfo, error)
ListFilesInDirectory lists files and directories in a specified path
func (*FileManager) ListFilesRecursively ¶
func (fm *FileManager) ListFilesRecursively(dir string) ([]os.FileInfo, error)
ListFilesRecursively lists all files and directories in a specified path recursively
func (*FileManager) ReadFile ¶
func (fm *FileManager) ReadFile(filePath string, output interface{}) error
ReadFile retrieves file content in the specified format
func (*FileManager) ReadUserInput ¶
func (fm *FileManager) ReadUserInput() (string, error)
ReadUserInput retrieves user input line by line
func (*FileManager) RemoveFileOrDirectory ¶
func (fm *FileManager) RemoveFileOrDirectory(path string) error
RemoveFileOrDirectory deletes a file or directory
func (*FileManager) Rename ¶
func (fm *FileManager) Rename(oldPath, newPath string) error
Rename changes the name of a file or directory
func (*FileManager) WriteFile ¶
func (fm *FileManager) WriteFile(filePath string, content interface{}) error
WriteFile creates or updates a file with specified content in the given format
func (*FileManager) WriteFileWithFunc ¶
func (fm *FileManager) WriteFileWithFunc(filePath string, contentFunc func() (interface{}, error)) error
type FileManagerInterface ¶
type FileManagerInterface interface {
ListFilesInDirectory(dir string) ([]os.FileInfo, error)
ListFilesRecursively(dir string) ([]os.FileInfo, error)
WriteFile(filePath string, content interface{}) error
ReadFile(filePath string, output interface{}) error
Has(path string) (bool, error)
RemoveFileOrDirectory(path string) error
Rename(oldPath, newPath string) error
ReadUserInput() (string, error)
}
FileManagerInterface defines the methods for the FileManager