Documentation ¶
Overview ¶
Package fs provides a uniform api for filesystem-related functions
Index ¶
- func CreateDirectory(path string, mode os.FileMode) error
- func CreateFile(path string, mode os.FileMode) error
- func CreateSymlink(source string, target string) error
- func DeleteDirectory(path string) error
- func DeleteDirectoryAll(path string) error
- func DeleteFile(path string) error
- func FileExtension(filepath string) (string, error)
- func HomeDirectory() (string, error)
- func PathExists(path string) (bool, error)
- func PathNotExists(path string) (bool, error)
- func ReadFile(path string) ([]byte, error)
- func WriteFile(path string, mode os.FileMode, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDirectory ¶
CreateDirectory simply checks if the directory path already exists before attempting to create the directory
func CreateFile ¶
CreateFile simply checks if the file path already exists before attempting to create the file
func CreateSymlink ¶
CreateSymlink simply creates a symbolic link after verifing the source exists
func DeleteDirectory ¶
DeleteDirectory simply checks if the directory path already exists before attempting to delete the directory
func DeleteDirectoryAll ¶
DeleteDirectoryAll simply checks if the directory path already exists before attempting to delete the directory and any child paths
func FileExtension ¶
FileExtension simply returns the Extension from a File Path in format of <filename>.<extension> (e.g. .json|.yaml|.txt etc)
func HomeDirectory ¶
HomeDirectory returns the home directory for the executing user. This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected. SEE: https://github.com/mitchellh/go-homedir/blob/master/homedir.go
func PathExists ¶
PathExists simply checks if a path exists on the filesystem Returns TRUE if the path does exist Returns FALSE if the path does *not* exist
func PathNotExists ¶
PathNotExists simply checks if a path does *not* exist on the filesystem Returns TRUE if the path does *not* exist Returns FALSE if the path does exist
Types ¶
This section is empty.