Documentation
¶
Index ¶
- Variables
- func AbsAll(paths []string) []string
- func Append(opts *options)
- func CalcSum(ctx context.Context, fn, hashType string) (digest string, err error)
- func Cat(filePath string, trimSpace ...bool) string
- func CatE(filePath string, trimSpace ...bool) (string, error)
- func CheckSum(ctx context.Context, fn, digest string) bool
- func CheckSumE(ctx context.Context, fn, digest string) (pass bool, err error)
- func CopyPipe(ctx context.Context, dst io.Writer, src io.Reader, progress func(int64)) (err error)
- func Delete(fn string) (err error)
- func Exists(p string) bool
- func FileCopy(src, dst string, opts ...Option) (err error)
- func FileInfoAccessTime(fi os.FileInfo) time.Time
- func IsRegular(path string) bool
- func List(root string, matches ...func(string, fs.DirEntry) error) (files []string, err error)
- func Open(filePath string, opts ...Option) (file *os.File, err error)
- func OpenRead(filePath string, processFunc ProcessFunc, opts ...Option) (err error)
- func OpenWrite(filePath string, processFunc ProcessFunc, opts ...Option) (err error)
- func Overwrite(opts *options)
- func PathIsDir(s string) bool
- func PathSplit(p string) (dir, name, ext string)
- func ReaderContext(ctx context.Context, r io.Reader) io.Reader
- func Readonly(opts *options)
- func WriteText(filePath string, text string, opts ...Option) (err error)
- type DeleteOptions
- type Option
- type ProcessFunc
- type ProgressFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidWrite = errors.New("invalid write result")
View Source
var ErrShortWrite = io.ErrShortWrite
Functions ¶
Types ¶
type DeleteOptions ¶
type DeleteOptions struct {
RemoveChildren bool //删除
}
type Option ¶
type Option func(*options)
Option 定义用于配置 options 的函数类型
func CreateDirs ¶
CreateDirs 返回一个 Option,用于设置是否自动创建目录及目录权限
type ProcessFunc ¶
ProcessFunc 定义了对已打开文件进行自定义处理的函数签名
func CalcMD5 ¶
func CalcMD5(hexMd5 *string) ProcessFunc
CalcMD5 返回一个 ProcessFunc,用于计算文件 MD5 值并写入 hexMd5 指针指向的字符串
func ReadTo ¶
func ReadTo(ctx context.Context, w io.Writer, progress ...ProgressFunc) ProcessFunc
ReadTo 返回一个 ProcessFunc,用于将文件内容读出到外部 Writer
func WriteFrom ¶
func WriteFrom(ctx context.Context, r io.Reader, progress ...ProgressFunc) ProcessFunc
WriteFrom 返回一个 ProcessFunc,用于将外部 Reader 数据写入文件
type ProgressFunc ¶
type ProgressFunc func(n int64)
ProgressFunc 定义了在拷贝过程中报告已拷贝字节数的函数签名
func ProgressJoin ¶
func ProgressJoin(progress ...ProgressFunc) ProgressFunc
Click to show internal directories.
Click to hide internal directories.