Documentation ¶
Overview ¶
Package pfs provides file-system related functions
Package pfs provides file-system related functions
Index ¶
- Constants
- Variables
- func Abs(dir string) (out string)
- func AbsEval(path string) (p string, err error)
- func AppDir(appName string) (directory string)
- func Dirs(dir string) (dirs []string, err error)
- func EnsureDirectory(directory string, dirMode fs.FileMode)
- func Exists(path string) (fileInfo fs.FileInfo)
- func GetModeBitValues() (s string)
- func IsDirectory(path string, flags IsDirectoryArg) (isDirectory bool, err error)
- func IsEmptyDirectory(path string) (isEmpty bool)
- func MoveOrMerge(src, dest string, outConsumer func(string)) (err error)
- func Mv(src, dest string, outConsumer func(string)) (err error)
- func NewContextReader(ctx context.Context, reader io.Reader) io.Reader
- func Stat(path string) (fileInfo fs.FileInfo, err error)
- func Walk(root string, walkFn filepath.WalkFunc) (err error)
- type AppDirectory
- type ContextReader
- type DLEntry
- type Directory
- type DirectoryLister
- type Entry
- type EntryResult
- type FSEntry
- type FileMode
- type IsDirectoryArg
- type Root
- type Sha256
- type Tree
Constants ¶
const ( // AllModeBits is all known github.com/fsnotify/fsevents.EventFlags AllModeBits fs.FileMode = fs.ModeDir | fs.ModeAppend | fs.ModeExclusive | fs.ModeTemporary | fs.ModeSymlink | fs.ModeDevice | fs.ModeNamedPipe | fs.ModeSocket | fs.ModeSetuid | fs.ModeSetgid | fs.ModeCharDevice | fs.ModeSticky | fs.ModeIrregular )
Variables ¶
var E = 17
Functions ¶
func Abs ¶ added in v0.4.23
Abs ensures a file system path is fully qualified. Abs is single-return-value and panics on troubles
func Dirs ¶
Dirs retrieves absolute paths to all directories, while following symlinks, from initial dir argument
func EnsureDirectory ¶
use 0 for default file mode owner rwx
func GetModeBitValues ¶
func GetModeBitValues() (s string)
func IsDirectory ¶
func IsDirectory(path string, flags IsDirectoryArg) (isDirectory bool, err error)
func IsEmptyDirectory ¶
func MoveOrMerge ¶
func NewContextReader ¶
NewContextReader instantiates ContextReader
Types ¶
type AppDirectory ¶
type AppDirectory struct {
App string
}
func NewAppDir ¶
func NewAppDir(appName string) (appd *AppDirectory)
NewAppDir returns an object providing an app-specific file system location with defered directory creation
func (*AppDirectory) Directory ¶
func (appd *AppDirectory) Directory() (directory string)
type ContextReader ¶
ContextReader reader terminated by context
type DLEntry ¶
type DirectoryLister ¶
type DirectoryLister struct { Path string // may begin with ., may be . Abs string Results chan *EntryResult // contains filtered or unexported fields }
func NewDirStream ¶
func NewDirStream(path string, chanSize int) (dir *DirectoryLister)
func (*DirectoryLister) Shutdown ¶
func (dir *DirectoryLister) Shutdown()
type Entry ¶
type Entry struct { Base string // we can have entries with FileInfo nil, so base path must be stored os.FileInfo // info.Name() has basename, os.FileInfo: interface Err error // a symlink may fail to resolve }
Entry is a file system entry that can be part of directory, symlink or other
type EntryResult ¶
func GetErrorResult ¶
func GetErrorResult(err error) (result *EntryResult)
type FSEntry ¶
type FSEntry interface { SafeName() string IsDir() bool Walk(path string, walkFunc filepath.WalkFunc) error }
FSEntry represnt a branch in a file system hierarchy FSEntry is implemented by Entry (file) or Directory or Root (walk entry point)
func NewDirectory ¶
NewDirectory instantiates FSEntry that can have children
type FileMode ¶
type IsDirectoryArg ¶
type IsDirectoryArg byte
const ( IsDirectoryNonExistentIsError IsDirectoryArg = 1 << iota IsDirectoryNotDirIsError )
type Root ¶
type Root struct { Path string // path as provided Evaled string // path after filepath.EvalSymlinks Err error FSEntry // Directory or Entry }
Root is a file system hierarchy
type Sha256 ¶
type Sha256 []byte
Sha256 contains sha-256 hash
func Sha256Context ¶
Sha256Context get sha256 of a file with context