xfile

package
v0.0.0-...-11a4950 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(path string) string

func Base

func Base(path string) string

func CopyDir

func CopyDir(src string, dst string) error

CopyDir 复制文件夹下的所有文件

func CopyFile

func CopyFile(src, dst string) error

CopyFile 复制文件

func Delete

func Delete(path string) error

func Dir

func Dir(path string) string

func Exists

func Exists(path string) bool

func Ext

func Ext(path string) string

func FixPath

func FixPath(path string) string

func GetBytes

func GetBytes(file string) ([]byte, error)

func GetContent

func GetContent(file string) (string, error)

func IsDir

func IsDir(path string) bool

IsDir 判断文件夹是否存在

func IsFile

func IsFile(path string) bool

IsFile 判断文件是否存在

func Join

func Join(elem ...string) string

Join 文件路径组合

func Mkdir

func Mkdir(path string) error

Mkdir 创建文件夹

func Move

func Move(oldPath, newPath string) error

func PutBytes

func PutBytes(file string, data []byte) error

func PutContent

func PutContent(file, content string) error

func RealPath

func RealPath(path string) string

func RemoveAll

func RemoveAll(path string) error

func RemoveFile

func RemoveFile(path string) error

func ScanDir

func ScanDir(path string, pattern string, recursives ...bool) ([]string, error)

func ScanDirConfig

func ScanDirConfig(path string, config ScanOption) ([]string, error)

ScanDirConfig 自定义扫描目录

func ScanFile

func ScanFile(path string, pattern string, recursives ...bool) ([]string, error)

ScanFile 获取目录下所有文件(不包含目录)

func ScanFiles

func ScanFiles(path string, pattern string, callback func(path string, d fs.DirEntry) bool, isRecursives ...bool) ([]string, error)

ScanFiles 获取目录下所有文件 Deprecated: 此函数已弃用,换xfile.ScanFile替代

func Stat

func Stat(path string) (os.FileInfo, error)

Types

type ScanOption

type ScanOption struct {
	Patterns  []string                 //文件匹配条件
	Recursive bool                     //是否递归查询
	Handler   func(path string) string //闭包处理
}

Jump to

Keyboard shortcuts

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