fs

package
v0.0.0-...-6c9e90c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEmptyFile

func CreateEmptyFile(path string) error

func CreateFileBackup

func CreateFileBackup(fName string)

func CreateFileWithContent

func CreateFileWithContent(path, content string) error

func CreateLinkIfNotExists

func CreateLinkIfNotExists(source string, check CheckLinkSource, destination string, logger log.Logger) error

func DoAbsolutePath

func DoAbsolutePath(p string, shouldBeDir bool) (string, error)

func FileExistsInDirAndParentsDirs

func FileExistsInDirAndParentsDirs(dir, fileName string) (string, error)

FileExistsInDirAndParentsDirs returns empty string if not found otherwise full path

func GetSystemDirectories

func GetSystemDirectories() []string

func IsDirExists

func IsDirExists(dir string) bool

func IsExists

func IsExists(path string) (bool, error)

func IsInSystemDirs

func IsInSystemDirs(dir string) (bool, []string)

func IsRoot

func IsRoot(dir string) bool

func IsSymlinkFromDirEntry

func IsSymlinkFromDirEntry(fullPath string, e fs.DirEntry) (bool, string, error)

func IsSymlinkFromInfo

func IsSymlinkFromInfo(fullPath string, stat fs.FileInfo) (bool, string, error)

func IsSystemDirOrUserHome

func IsSystemDirOrUserHome(dir string) (bool, []string, error)

IsSystemDirOrUserHome dir must be absolute and cleaned

func RandomNumberSuffix

func RandomNumberSuffix(name string) string

The suffix will consist of 128 bits of non-secure randomness composed in 32 hex digits, 16 bytes. For example, for "name-here" the call will produce something like "name-here-7d03f3e265dace994308fc812e9ab366"

func RandomTmpDirWithNRunes

func RandomTmpDirWithNRunes(rootDir, idSalt string, firstIdRunes int) (string, error)

func RandomTmpFileName

func RandomTmpFileName() string

func RevealWildcardPaths

func RevealWildcardPaths(paths []string) []string

func StartFileWatcher

func StartFileWatcher(path string, fsEventHanlder func(event fsnotify.Event), done chan struct{}, logger log.Logger) (*fsnotify.Watcher, error)

func TouchFile

func TouchFile(path string) error

func WriteContentIfNeed

func WriteContentIfNeed(file string, newContent []byte) error

Types

type CheckLinkSource

type CheckLinkSource func(string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL