Documentation
¶
Index ¶
- Variables
- func AvailableSpace(path string) (uint64, error)
- func BackupDir(ctx context.Context, srcDir, outArchive string, removeSrc bool, ...) (err error)
- func CountFilesAndDirs(dir string) (filec, dirc int, err error)
- func DirBtimeSpan(dir string, recursive bool) (oldest, newest time.Time, bspan time.Duration, err error)
- func DirSize(dir string) (int64, error)
- func FileSELinuxContext(f *os.File) (string, error)
- func IsDir(path string) bool
- func IsRegular(path string) bool
- func IsStdoutStderrFile(expectedPath string) (bool, error)
- func IsSymlink(path string) bool
- func SELinuxContext(path string) (string, error)
- func UserDataDir(appslug string) string
- func UserRuntimeDir(appslug string) string
- func UserStateDir(appslug string) string
- type FileInfo
Constants ¶
This section is empty.
Variables ¶
var (
Error = errors.New("fsutils")
)
Functions ¶
func AvailableSpace ¶
AvailableSpace calculates the available space on the filesystem where path resides.
func CountFilesAndDirs ¶ added in v0.4.0
CountFilesAndDirs counts regular files and directories in dir and its subdirectories.
func DirBtimeSpan ¶ added in v0.4.0
func DirBtimeSpan(dir string, recursive bool) (oldest, newest time.Time, bspan time.Duration, err error)
DirBtimeSpan returns the time duration between the oldest and newest file in the directory based on their Btime (creation time). If recursive is true, it includes files in subdirectories; otherwise, it scans only the top-level directory.
func DirSize ¶
DirSize calculates the total size of a directory by traversing it and summing the sizes of all encountered files. DirSize calculates the total size of regular files in dir and its subdirectories, excluding symlinks.
func FileSELinuxContext ¶ added in v0.4.0
FileSELinuxContext retrieves the file's SELinux context (e.g., "unconfined_u:object_r:config_home_t:s0").
func IsRegular ¶ added in v0.2.0
IsRegular reports whether the path is a regular file. Follows symlinks, so a symlink pointing to a regular file returns true.
func IsStdoutStderrFile ¶ added in v0.4.0
func SELinuxContext ¶ added in v0.4.0
SELinuxContext retrieves the file's SELinux context (e.g., "unconfined_u:object_r:config_home_t:s0") for the given file path.
func UserDataDir ¶ added in v0.4.0
UserDataDir returns the platform path for shared persistent data.
func UserRuntimeDir ¶ added in v0.4.0
UserRuntimeDir return user runtime dir.
func UserStateDir ¶ added in v0.4.0
UserStateDir returns the platform path for shared state data.
Types ¶
type FileInfo ¶ added in v0.4.0
type FileInfo struct {
Name string
Atime time.Time // Last access time
Btime time.Time // Birth (creation) time
Ctime time.Time // Last status change time
Mtime time.Time // Last modification time
Blksize uint32
Nlink uint32
Size uint64
Blocks uint64
Ino uint64
Mode uint16
Uid uint32
Gid uint32
DevMajor uint32
DevMinor uint32
}
FileInfo describes a file it holds file access, birth, change, and modification times.