Documentation
¶
Index ¶
- func AbsPath(pth string) (string, error)
- func AppendBytesToFile(pth string, fileCont []byte) error
- func AppendStringToFile(pth string, fileCont string) error
- func ChangeDirForFunction(dir string, fn func()) error
- func CopyDir(src, dst string, isOnlyContent bool) error
- func CopyFile(src, dst string) error
- func CurrentWorkingDirectoryAbsolutePath() (string, error)
- func DownloadAndUnZIP(url, pth string) error
- func EnsureDirExist(dir string) error
- func ExpandTilde(pth string) (string, error)
- func GetFileModeOfFile(pth string) (os.FileMode, error)
- func GetFileName(path string) string
- func GetFilePermissions(filePth string) (os.FileMode, error)
- func IsDirExists(pth string) (bool, error)
- func IsPathExists(pth string) (bool, error)
- func IsRelativePath(pth string) bool
- func NormalizedOSTempDirPath(tmpDirNamePrefix string) (retPth string, err error)
- func PathCheckAndInfos(pth string) (os.FileInfo, bool, error)
- func ReadBytesFromFile(pth string) ([]byte, error)
- func ReadFileInto(filename string, v proto.Message) error
- func ReadLongLine(r *bufio.Reader) (string, error)
- func ReadStringFromFile(pth string) (string, error)
- func RemoveAll(pths ...string) error
- func RemoveDir(dirPth string) error
- func RemoveFile(pth string) error
- func RetrieveArchive(fs afero.Fs, uri string) (io.ReadCloser, error)
- func RevokableChangeDir(dir string) (func() error, error)
- func Tar(src string, fs afero.Fs, writers ...io.Writer) error
- func UnZIP(src, dest string) error
- func UnZip(zip, intoDir string) error
- func Untar(dst, src string, fs afero.Fs) error
- func UserHomeDir() string
- func WalkLines(inpReader io.Reader, walkFn WalkLineFn) error
- func WalkLinesString(inputStr string, walkFn WalkLineFn) error
- func WriteBytesToFile(pth string, fileCont []byte) error
- func WriteBytesToFileWithPermission(pth string, fileCont []byte, perm os.FileMode) error
- func WriteStringToFile(pth string, fileCont string) error
- func WriteStringToFileWithPermission(pth string, fileCont string, perm os.FileMode) error
- func WriteToFile(filename string, pb proto.Message) error
- func ZipDir(sourceDirPth, destinationZipPth string, isContentOnly bool) error
- func ZipFile(sourceFilePth, destinationZipPth string) error
- type WalkLineFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBytesToFile ¶
AppendBytesToFile ...
func AppendStringToFile ¶
AppendStringToFile ...
func ChangeDirForFunction ¶
ChangeDirForFunction ...
func CurrentWorkingDirectoryAbsolutePath ¶
CurrentWorkingDirectoryAbsolutePath ...
func GetFileModeOfFile ¶
GetFileModeOfFile ...
this is the "permissions" info, which can be passed directly to functions like WriteBytesToFileWithPermission or os.OpenFile
func GetFileName ¶
GetFileName returns the name of the file from a given path or the name of the directory if it is a directory
func GetFilePermissions ¶
GetFilePermissions ...
- alias of: GetFileModeOfFile this is the "permissions" info, which can be passed directly to functions like WriteBytesToFileWithPermission or os.OpenFile
func NormalizedOSTempDirPath ¶
NormalizedOSTempDirPath ... Creates a temp dir, and returns its path. If tmpDirNamePrefix is provided it'll be used
as the tmp dir's name prefix.
Normalized: it's guaranteed that the path won't end with '/'.
func PathCheckAndInfos ¶
PathCheckAndInfos ... Returns: 1. file info or nil 2. bool, indicating whether the path exists 3. error, if any error happens during the check
func ReadLongLine ¶
ReadLongLine - an alternative to bufio.Scanner.Scan, which can't handle long lines. This function is slower than bufio.Scanner.Scan, but can handle arbitrary long lines.
func ReadStringFromFile ¶
ReadStringFromFile ...
func RemoveFile ¶
RemoveFile ... Deprecated: use RemoveAll instead.
func RetrieveArchive ¶
Retrieves the file from the given uri The uri can be a remote url or a file on the local fs This function returns a ReadCloser and it is the responsibility of the caller to close it
func RevokableChangeDir ¶
RevokableChangeDir ...
func WalkLinesString ¶
func WalkLinesString(inputStr string, walkFn WalkLineFn) error
WalkLinesString ...
func WriteBytesToFile ¶
WriteBytesToFile ...
func WriteBytesToFileWithPermission ¶
WriteBytesToFileWithPermission ...
func WriteStringToFile ¶
WriteStringToFile ...
func WriteStringToFileWithPermission ¶
WriteStringToFileWithPermission ...
Types ¶
type WalkLineFn ¶
WalkLineFn - gets a line as its input if returns an error it stops the walk/reading to break the walk early, without an error, just return io.EOF