modulepackage
0.0.0-20220606043151-d9e7af5d8b20
Repository: https://github.com/supercom32/filesystem.git
Documentation: pkg.go.dev
# README
Filesystem
Filesystem is a package which allow users to perform high-level disk operations simply and easily. This package was created in an attempt to eliminate all the annoying code associated with file system calls (which inevitably end up being duplicated between projects anyway).
Features
- A wide variety of common filesystem operations are available!
- All methods are abstracted out to be as simple to use as possible!
- All methods are obviously labeled, straight forward, and as self-explanatory as possible!
- No need to remember/learn yet another set of basic filesystem calls for a new language!
# Functions
*
AppendLineToFile allows you to append a line to the end of a file.
*
CopyFile allows you to copy a file from one source location to a target
destination location.
*
CreateDirectory allows you to create a directory on your local file system.
DeleteDirectory allows you to recursively remove a directory from the file
system.
*
DeleteFile allows you to delete a file on the file system.
*
DeleteFilesMatchingPattern allows you to delete files matching a specific
pattern.
*
DownloadFile allows you to download a file from the internet to your local file
system.
*
FindMatchingContent allows you to find matching content from a given directory
path.
FindReplaceInFile allows you to find and replace text from within a file.
GetBareDirectoryPath allows you to get a directory path without a trailing
slash.
*
GetBaseDirectory allows you to extract the directory from a file path.
*
GetBaseFileName allows you to extract the base name of a file without any path or
file extensions.
GetCurrentDirectory allows you to obtain the current directory from a fully
qualified directory path.
GetDefaultCacheDirectory allows you to obtain the cache directory of a user.
GetFileContents allows you to get the entire contents of a file.
*
GetFileContentsAsBytes allows you to get the contents of a file as a byte
array.
*
GetFileExtension allows you to get the file extension of a file.
GetFileInstance allows you to obtain a file instance to work on.
*
GetFileNameFromPath allows you to extract a file name from a fully qualified file path.
*
GetFileSize allows you to obtain the size of a specified file in bytes.
GetLastLineFromFile allows you to obtain the last line from a file.
*
GetListOfDirectories allows you to obtain a list of files that match a given
regular expression.
*
GetListOfDirectoryContents allows you to obtain a list of files and directories
that match a given regular expression.
*
GetListOfFiles allows you to obtain a list of files that match a given regular
expression.
*
GetNormalizedDirectoryPath allows you to guarantee that a directory path
is always formatted with a trailing slash at the end.
*
GetParentDirectory allows you to obtain the container directory of
your provided path.
*
GetWorkingDirectory allows you to obtain the current working directory
where your program is executing.
IsDirectory allows you to check if a disk entry is a directory or not.
*
IsDirectoryEmpty allows you to detect if a directory is empty or not.
*
IsDirectoryExists allows you to check if a directory exists or not on the file
system.
*
IsFile allows you to check if an item on the file system is a file or not.
IsFileContainsText allows you to check if a file contains a matching string or not.
*
IsFileExists allows you to check if a file exists or not on the file system.
*
MoveFile allows you to move a file from one location to another.
RemoveFirstLineFromFile allows you to remove the first line from a file.
*
RenameFile allows you to rename a file on your local file system.
*
WriteBytesToFile allows you to write a series of bytes to a given file.