Documentation
¶
Index ¶
- func CleanDir(dir string) error
- func ConvertTilda(path string) (string, error)
- func CopyFile(src, dst string) (int64, error)
- func DirExists(path string) (exists bool, empty bool, err error)
- func Download(rawURL, destDir string, showProgress bool) (string, error)
- func ExtractBz2(srcPath, dstDir string) error
- func ExtractGz(srcPath, dstDir string) error
- func ExtractTar(srcPath, dstDir string) error
- func ExtractTarBz2(srcPath, dstDir string) error
- func ExtractTarGz(srcPath, dstDir string) error
- func ExtractTarXz(srcPath, dstDir string) error
- func ExtractXz(srcPath, dstDir string) error
- func ExtractZip(srcPath, dstDir string) error
- func FileExists(f string) (bool, error)
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsTextFile(path string) (bool, error)
- func MakeDir(dir string) error
- func Ping(host string, seconds int) bool
- func SplitPath(path string) (dir, base, ext string)
- type DirState
- type ErrDownload
- type ErrExtract
- type ErrFileMissing
- type ErrNotDir
- type ErrNotFile
- type Extractor
- type FileType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanDir ¶
CleanDir removes all files from a directory or creates the directory if it is absent.
func ConvertTilda ¶
ConvertTilda expands paths with `~/` to an actual home directory.
func CopyFile ¶ added in v0.3.9
CopyFile copies a file from src to dst. If dst does not exist, it is created. If dst already exists, its contents are truncated.
func Download ¶ added in v0.3.0
Download copies remote file to local drive. It provides the name of downloaded file and error as output. Supports http://, https://, and file:// URLs.
func ExtractBz2 ¶ added in v0.4.2
ExtractBz2 extracts a bz2 compressed file located at srcPath to the destination directory dstDir.
func ExtractGz ¶ added in v0.3.7
ExtractGz extracts a gz compressed file located at srcPath to the destination directory dstDir.
func ExtractTar ¶ added in v0.3.5
ExtractTar extracts a tar archive located at srcPath to the destination directory dstDir.
func ExtractTarBz2 ¶ added in v0.3.5
ExtractTarBz2 extracts a tar.bz2 archive located at srcPath to the destination directory dstDir.
func ExtractTarGz ¶ added in v0.3.5
ExtractTarGz extracts a tar.gz archive located at srcPath to the destination directory dstDir.
func ExtractTarXz ¶ added in v0.3.5
ExtractTarXz extracts a tar.xz archive located at srcPath to the destination directory dstDir.
func ExtractXz ¶ added in v0.4.1
ExtractXz extracts an xz compressed file located at srcPath to the destination directory dstDir.
func ExtractZip ¶ added in v0.3.5
ExtractZip extracts a zip archive located at srcPath to the destination directory dstDir.
func FileExists ¶
FileExists checks if a file exists, and that it is a regular file.
func IsTextFile ¶ added in v0.3.8
Types ¶
type DirState ¶ added in v0.2.4
type DirState int
DirState represents the state of a directory.
func GetDirState ¶ added in v0.2.4
GetDirState returns the state of a directory.
type ErrDownload ¶ added in v0.3.4
ErrDownload is returned when a file download operation fails. The URL field specifies the URL that was being downloaded, and the Err field contains the underlying error that caused the download to fail.
func (*ErrDownload) Error ¶ added in v0.3.4
func (e *ErrDownload) Error() string
type ErrExtract ¶ added in v0.3.5
ErrExtract is returned when the extraction of a file (e.g., Zip, Tar file) fails. The Path field specifies the file that was being extracted, and the Err field contains the underlying error that caused the extraction to fail.
func (*ErrExtract) Error ¶ added in v0.3.5
func (e *ErrExtract) Error() string
type ErrFileMissing ¶ added in v0.3.5
type ErrFileMissing struct {
Path string
}
ErrFileMissing indicates that a file at the specified path could not be found.
func (*ErrFileMissing) Error ¶ added in v0.3.5
func (e *ErrFileMissing) Error() string
type ErrNotDir ¶ added in v0.3.5
type ErrNotDir struct {
Path string
}
ErrNotDir indicates that the path provided does not refer to a directory. It might be a file, symbolic link, or another type of file system entry.
type ErrNotFile ¶ added in v0.3.5
type ErrNotFile struct {
Path string
}
ErrNotFile indicates that the path provided does not refer to a regular file. It might be a directory, symbolic link, or another type of file system entry.
func (*ErrNotFile) Error ¶ added in v0.3.5
func (e *ErrNotFile) Error() string