Documentation ¶
Overview ¶
Package fs contains utilities to check if files or directories exist and closing files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseFile ¶
CloseFile closes the file and handles the error if it occurs by printing it out and exiting with a code of 1.
Example:
file, err := os.Open(filePath) ... handle error defer fs.CloseFile(file)
func DirExists ¶
DirExists checks if a directory exists.
The given dirPath should be an absolute path. Returns true if the directory exists; false otherwise.
Example:
exists, err := fs.DirExists(dirPath) if err != nil { ... handle error } if exists { ... do work }
func FileExists ¶
FileExists checks if a file exists and is not a directory.
The given filePath should be an absolute path. Returns true if the file exists; false otherwise.
Example:
exists, err := fs.FileExists(filePath) if err != nil { ... handle error } if exists { ... do work }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.