package
0.0.0-20241018223127-a062be16fda2
Repository: https://github.com/activestate/cli.git
Documentation: pkg.go.dev
# Functions
AmendFile amends data to a file, supports append, or prepend.
No description provided by the author
AppendToFile appends the data to the file (if it exists) with the given data, if the file doesn't exist it is created and the data is written.
No description provided by the author
CopyAndRenameFiles copies files from fromDir to toDir.
No description provided by the author
CopyFile copies a file from one location to another.
CopyFiles will copy all of the files/dirs within one directory to another.
No description provided by the author
No description provided by the author
CopySymlink reads the symlink at src and creates a new link at dest.
DirExists checks if the given directory exists.
No description provided by the author
FileExists checks if the given file (not folder) exists.
FindFileInPath will find a file by the given file-name in the directory provided or in one of the parent directories of that path by walking up the tree.
GetLongPathName returns the Windows long path (ie.
GetShortPathName returns the Windows short path This function does not alter the path in any way on Linux or MacOS.
HashDirectory will sha256 hash the given directory.
No description provided by the author
IsBinary checks if the given bytes are for a binary file.
IsDir returns true if the given path is a directory.
IsEmptyDir returns true if the directory at the provided path has no files (including dirs) within it.
IsExecutable determines if the file at the given path has any execute permissions.
IsSymlink checks if a path is a symlink.
IsWritable returns true if the given path is writable.
Join is identical to filepath.Join except that it doesn't clean the input, allowing for more consistent behavior.
ListDir recursively lists filepaths under the given sourcePath This does not follow symlinks.
ListDirSimple recursively lists filepaths under the given sourcePath This does not follow symlinks.
ListFilesUnsafe lists filepaths under the given sourcePath non-recursively.
LogPath will walk the given file path and log the name, permissions, mod time, and file size of all files it encounters.
Mkdir is a small helper function to create a directory if it doesnt already exist.
MkdirUnlessExists will make the directory structure if it doesn't already exists.
No description provided by the author
MoveAllFiles will move all of the files/dirs within one directory to another directory.
MoveAllFilesCrossDisk will move all of the files/dirs within one directory to another directory even across disks.
MoveAllFilesRecursively moves files and directories from one directory to another.
PathContainsParent checks if the directory path is equal to or a child directory of the targeted directory.
PathInList returns whether the provided path list contains the provided path.
PathsEqual checks whether the paths given all resolve to the same path.
PathsMatch checks if all the given paths resolve to the same value.
PrepareDir prepares a path by ensuring it exists and the path is consistent.
PrependToFile prepends the data to the file (if it exists) with the given data, if the file doesn't exist it is created and the data is written.
ReadFile reads the content of a file.
ReadFileUnsafe is an unsafe version of os.ReadFile, DO NOT USE THIS OUTSIDE OF TESTS.
ReplaceAll replaces all instances of search text with replacement text in a file, which may be a binary file.
ResolvePath gets the absolute location of the provided path and fully evaluates the result if it is a symlink.
No description provided by the author
ResolveUniquePath gets the absolute location of the provided path with the best effort attempt to produce the same result for all possible paths to the given target.
Sha256Hash will sha256 hash the given file.
SymlinkTarget retrieves the target of the given symlink.
TargetExists checks if the given file or folder exists.
No description provided by the author
TempDirUnsafe returns a temp path or panics if it cannot be created This is for use in tests, do not use it outside tests!.
No description provided by the author
TempFileUnsafe returns a tempfile handler or panics if it cannot be created This is for use in tests, do not use it outside tests!.
Touch will attempt to "touch" a given filename by trying to open it read-only or create the file with 0644 perms if it does not exist.
TouchFileUnlessExists will attempt to "touch" a given filename if it doesn't already exists.
WriteFile writes data to a file, if it exists it is overwritten, if it doesn't exist it is created and data is written.
WriteTempFile writes data to a temp file.
WriteTempFileToDir writes data to a temp file in the given dir.
# Constants
AmendByAppend content to end of file.
AmendByPrepend - add content start of file.
DirMode is the mode used for created dirs.
FileMode is the mode used for created files.
No description provided by the author
WriteOverwrite file with contents.
# Variables
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
AmendOptions used to specify write actions for WriteFile.
No description provided by the author
MoveAllFilesCallback is invoked for every file that we move.