path

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPathContent added in v1.4.0

func CleanPathContent(dirPath string)

func CopyPath added in v1.4.0

func CopyPath(srcPath, dstPath string) error

CopyPath 深度复制目录结构及内容 特性: - 保留文件权限和修改时间 - 并行文件复制(最大4并发) - 自动创建目标目录 - 完善的错误处理链

func Exist

func Exist(path string) bool

Exist 路径是否存在

func IsDir added in v1.4.0

func IsDir(path string) bool

func IsDirEmpty added in v1.3.65

func IsDirEmpty(dirPath string) (bool, error)

IsDirEmpty 判断目录是否为空

func IsSubPath added in v1.4.5

func IsSubPath(topPath, subPath string) bool

IsSubPath 判断subPath是否是topPath的子路径

func ListPath added in v1.4.0

func ListPath(filePath string, filterPattern string, recursive bool) ([]string, error)

ListPath 列出指定目录下的文件 filePath 路径 filterPattern 过滤规则 recursive 是否递归

func SplitParentDir added in v1.3.67

func SplitParentDir(dirPath string) string

func WalkPath

func WalkPath(filePath string) ([]string, error)

WalkPath 遍历指定目录

Types

type Event added in v1.4.5

type Event struct {
	Path string
	Op   Op
}

type Monitor added in v1.4.5

type Monitor struct {
	// contains filtered or unexported fields
}

监控指定目录及其子目录下的文件变化 包括新增、删除和修改

func NewMonitor added in v1.4.5

func NewMonitor(ignores fu.StringSet) (*Monitor, error)

func (*Monitor) AddIgnore added in v1.4.5

func (s *Monitor) AddIgnore(ignores fu.StringSet)

func (*Monitor) AddObserver added in v1.4.5

func (s *Monitor) AddObserver(observer Observer)

func (*Monitor) AddPath added in v1.4.5

func (s *Monitor) AddPath(path string) error

func (*Monitor) RemoveObserver added in v1.4.5

func (s *Monitor) RemoveObserver(observer Observer)

func (*Monitor) RemovePath added in v1.4.5

func (s *Monitor) RemovePath(path string) error

func (*Monitor) Start added in v1.4.5

func (s *Monitor) Start() error

func (*Monitor) Stop added in v1.4.5

func (s *Monitor) Stop() error

type Observer added in v1.4.5

type Observer interface {
	OnEvent(event Event)
}

type Op added in v1.4.5

type Op uint32
const (
	Create Op = 1 << iota
	Modify
	Remove
)

func (Op) String added in v1.4.5

func (s Op) String() string

Jump to

Keyboard shortcuts

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