Documentation
¶
Index ¶
- func CleanFileName(name string) string
- func CreateDir(path string) error
- func DirIsEmpty(path string) (bool, error)
- func Eon[V, E any](_ V, e E) E
- func Fcp(srcPath, dstPath string) error
- func FileCheck(target string) (skipExist bool, err error)
- func FileExist(path string) error
- func From(src *os.File) func(dst *os.File) error
- func ListFiles(sources []string, recursive bool, onError func(error) error) (files []string, err error)
- func NotExist(path string) error
- func Open(path string, process func(r *os.File) error, options ...FileOpenOption) error
- func RenameFile(from, to string) error
- func Split(path string) (dir, name, ext string)
- func To(dst *os.File) func(src *os.File) error
- func UseTempFile(dstPath string, process func(tempFile *os.File) error) (err error)
- func Von[V, E any](v V, _ E) V
- func WriteToFile(dstPath string) func(src *os.File) error
- type FileOpenOption
- type FileOpenOptions
- type SortFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanFileName ¶
CleanFileName 清理文件名,移除非法字符、控制字符、下划线、连续空白字符、连续点号、下划线前后的多余空格
可选参数 keepHeadDot:是否保留首尾的点号(默认保留) 返回清理后的文件名, 如果文件名为空, 则返回空字符串
func DirIsEmpty ¶
func ListFiles ¶
func ListFiles(sources []string, recursive bool, onError func(error) error) (files []string, err error)
ListFiles 遍历 sources 中的路径,返回文件列表 sources: 需要遍历的文件或目录路径列表 recursive: 是否递归遍历子目录 onError: 错误处理回调函数,当遇到无法访问的路径时触发
func RenameFile ¶
RenameFile 单个文件重命名,自动覆盖目标(如果目标存在且为单文件或者空文件夹)
func UseTempFile ¶
Types ¶
type FileOpenOption ¶
type FileOpenOption func(*FileOpenOptions)
func Flag ¶
func Flag(flag int) FileOpenOption
func Writeable ¶
func Writeable(appendFlag ...int) FileOpenOption
type FileOpenOptions ¶
Click to show internal directories.
Click to hide internal directories.