Documentation
¶
Index ¶
- Variables
- func AbsPath(path string, options ...Option) (abspath string, err error)
- func CheckPath(path string, config Config) bool
- func Chmod(path string, perm any) error
- func CopyFile(src string, dst string, options ...Option) (err error)
- func Index(r io.Reader, needles ...[]byte) (index int64, err error)
- func Info(path string) map[string]string
- func IsDir(path string) bool
- func IsPath(path string) bool
- func IsReadable(path string) bool
- func IsRegular(path string) bool
- func IsWritable(path string) bool
- func List(dir string, options ...Option) (files []string, err error)
- func MakeByteFinder(pattern []byte) *byteFinder
- func Mkdir(path string, options ...Option) (abspath string, err error)
- func NextPath(name string) string
- func OnAbsPath(c *Config)
- func PathPerm(path string) string
- func Perm(perm any) os.FileMode
- func RelRoot(path string) (string, error)
- func RmPath(path string) error
- func SHA1(fname string) (string, error)
- func Size(fname string) (int64, error)
- func Store(path string, data interface{}, options ...Option) (err error)
- func TempDir(dir string, options ...Option) (abspath string, err error)
- func Unzip(zipfile string, dir string, options ...Option) (files []string, err error)
- func WithAtomic(c *Config)
- func WithKeepMTime(c *Config)
- func WithKeepPerm(c *Config)
- func WithLower(c *Config)
- func WithOnlyDirs(c *Config)
- func WithOnlyFiles(c *Config)
- func WithRecurse(c *Config)
- func WithRelPath(c *Config)
- func Zip(dir string, zipfile string, options ...Option) (err error)
- type Config
- type Option
- func Options(options ...Option) []Option
- func WithBackupDir(path string) Option
- func WithBaseDir(dir string) Option
- func WithContent[S ~string | []byte](content S) Option
- func WithCreateDir(perm any) Option
- func WithMTimeAfter(t *time.Time) Option
- func WithMTimeBefore(t *time.Time) Option
- func WithMax(mx int) Option
- func WithPerm(perm any) Option
- func WithPrefix(prefix string) Option
- func WithSuffix(suffix string) Option
Constants ¶
This section is empty.
Variables ¶
View Source
var CacheFile = xdg.CacheFile
View Source
var ConfigFile = xdg.ConfigFile
View Source
var DataFile = xdg.DataFile
View Source
var Fetch = os.ReadFile
View Source
var FileType = map[rune]string{
'?': "Unknown",
'-': "Regular file",
'd': "Directory file",
'b': "Block file",
'c': "Character device file",
'l': "Symbolic link file",
'p': "Named pipe file",
's': "Socket file",
}
View Source
var Reload = xdg.Reload
View Source
var RuntimeFile = xdg.RuntimeFile
View Source
var SearchCacheFile = xdg.SearchCacheFile
View Source
var SearchConfigFile = xdg.SearchConfigFile
View Source
var SearchDataFile = xdg.SearchDataFile
View Source
var SearchRuntimeFile = xdg.SearchRuntimeFile
View Source
var SearchStateFile = xdg.SearchStateFile
View Source
var StateFile = xdg.StateFile
Functions ¶
func CopyFile ¶
CopyFile copies a file to another file or to a directory - src: sourcefile - dst: destination (if a directory, the basename of src is appended) options:
backupdir: if destination exists, it is copied to this directory keepperm: copies permissions and ownership to the destination keepmtime: copies mtime of source to destination
func MakeByteFinder ¶
func MakeByteFinder(pattern []byte) *byteFinder
func Perm ¶
Perm translates the rwxrwxrwx permission indicators to a os.FileMode. There are a few predefined filetypes
func RelRoot ¶ added in v1.0.5
RelRoot calculates the relative path from the root directory of the path
func TempDir ¶
TempDir creates a temporary subdirectory in dir
Options:
prefix: a prefix for the temporary dir suffix: a suffix for the temporary dir
func WithAtomic ¶
func WithAtomic(c *Config)
func WithKeepMTime ¶
func WithKeepMTime(c *Config)
func WithKeepPerm ¶
func WithKeepPerm(c *Config)
func WithOnlyDirs ¶
func WithOnlyDirs(c *Config)
func WithOnlyFiles ¶
func WithOnlyFiles(c *Config)
func WithRecurse ¶
func WithRecurse(c *Config)
func WithRelPath ¶ added in v1.0.1
func WithRelPath(c *Config)
Types ¶
type Option ¶
type Option func(*Config)
func WithBackupDir ¶
func WithBaseDir ¶ added in v1.0.7
func WithContent ¶
func WithCreateDir ¶
func WithMTimeAfter ¶
func WithMTimeBefore ¶
func WithPrefix ¶
func WithSuffix ¶
Click to show internal directories.
Click to hide internal directories.