Documentation ¶
Index ¶
- Variables
- func AppendFile(path string, data []byte) error
- func BaseName(path string) string
- func Chmod(name string, mode os.FileMode) error
- func Chown(name string, uid, gid int) error
- func ConfigDir() string
- func Copy(srcPath, dstPath string) error
- func CopyDir(srcPath string, dstPath string) error
- func CopyFile(srcPath string, dstPath string) error
- func CreateDir(path string, perm ...iofs.FileMode) error
- func CreateFile(path string) (*os.File, error)
- func CreateSymbolicLink(srcPath, dstPath string) error
- func CurrentDir() string
- func DirName(path string) string
- func ExtName(path string) string
- func ExtractTarGz(stream io.Reader, destDir string, logHandler func(filename string)) error
- func HomeDir() string
- func IsAbsPath(path string) bool
- func IsDir(path string) bool
- func IsEmpty(path string) bool
- func IsExist(path string) bool
- func IsFile(path string) bool
- func IsSymbolicLink(path string) bool
- func JoinConfigDir(appName string, configName ...string) string
- func JoinCurrentDir(relativePath string) string
- func JoinHomeDir(relativePath string) string
- func JoinPath(paths ...string) string
- func ListDir(path string) ([]iofs.FileInfo, error)
- func Merge(filePath string, parts []*FilePart) error
- func Mkdir(path string, perm ...iofs.FileMode) error
- func Mkdirp(path string, perm ...iofs.FileMode) error
- func Move(srcPath, dstPath string) error
- func MoveDir(srcPath string, dstPath string) error
- func MoveFile(srcPath, dstPath string) error
- func Open(path string) (*os.File, error)
- func OpenFile(path string, flagAndPerm ...interface{}) (*os.File, error)
- func ReadFile(srcPath string) ([]byte, error)
- func ReadFileAsString(srcPath string) (string, error)
- func ReadFileLines(srcPath string) ([]string, error)
- func Remove(path string) error
- func RemoveDir(path string) error
- func RemoveFile(path string) error
- func Rename(srcPath, dstPath string) error
- func RenameDir(srcPath string, dstPath string) error
- func RenameFile(srcPath, dstPath string) error
- func Size(path string) int64
- func Stat(path string) (os.FileInfo, error)
- func SystemConfigDir() string
- func TmpDirPath() string
- func TmpFilePath() string
- func UserConfigDir() string
- func Walk(path string, fn iofs.WalkDirFunc) error
- func WalkDir(path string, fn iofs.WalkDirFunc) error
- func WatchDir(ctx context.Context, paths []string, ...) error
- func WriteFile(path string, data []byte) (err error)
- type FilePart
Constants ¶
This section is empty.
Variables ¶
var Version = "1.3.15"
Version is the current version of the package.
Functions ¶
func AppendFile ¶ added in v1.3.5
AppendFile appends a file.
func ConfigDir ¶ added in v1.3.2
func ConfigDir() string
ConfigDir returns the config dir by user
if user is root, return system config dir if user is common user, return user home config dir
func CreateSymbolicLink ¶
CreateSymbolicLink creates a symbolic link
func ExtractTarGz ¶ added in v1.2.5
ExtractTarGz extracts a tar.gz file.
func IsSymbolicLink ¶
IsSymbolicLink checks whether the path is a symbolic link.
func JoinConfigDir ¶ added in v1.3.2
JoinConfigDir returns the config of appName + configName. configName default is config.yml.
func JoinCurrentDir ¶ added in v1.3.2
JoinCurrentDir returns the path which relative with current dir.
func JoinHomeDir ¶ added in v1.3.2
JoinHomeDir returns the path which relative with homedir.
func ReadFileAsString ¶
ReadFileAsString reads a file as string.
func ReadFileLines ¶
ReadFileLines reads a file by line.
func SystemConfigDir ¶ added in v1.3.12
func SystemConfigDir() string
SystemConfigDir returns the system config directory, which is /etc
func UserConfigDir ¶ added in v1.3.12
func UserConfigDir() string
UserConfigDir returns the user config directory, which is $HOME/.config
func WalkDir ¶
func WalkDir(path string, fn iofs.WalkDirFunc) error
WalkDir walks the files in a directory.