file_op

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeFileName

func ChangeFileName(path string, dstName string) (string, error)

ChangeFileName description 修改文件名

func Compress

func Compress(pkgPath string, paths ...string) error

Compress @param filePath 需要压缩文件或者目录的路径 @param dest 压缩目标文件 @description 压缩文件

func CreateFile

func CreateFile(path string) (*os.File, error)

CreateFile @description 创建文件,先检查文件是否存在,存在就报错,不存在就创建

func Decompress

func Decompress(srcPath, dstPath string) error

Decompress @param srcPath 压缩包路径 @param dstPath 解压路径

func IsExists

func IsExists(path string) bool

IsExists @description 判断路径是否存在

func IsPermission

func IsPermission(path string) bool

IsPermission description 判断文件是否有权限操作

func Mkdir

func Mkdir(path string) error

Mkdir @description 创建一个目录

func MustOpenFile

func MustOpenFile(path string) (*os.File, error)

MustOpenFile @description 直接打开文件,使用该方法的前提是确定文件一定存在

func Remove

func Remove(path string) error

Remove @description 删除文件

Types

type FileOp

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

func CreateFileOp

func CreateFileOp(path string, maxSize int, needCompress bool) *FileOp

func (*FileOp) Close

func (fo *FileOp) Close() error

func (*FileOp) Write

func (fo *FileOp) Write(buf []byte) error

Write @param buf 需要写入的字节 @description 这里不做并发控制,由 Logger 传递过来的日志数据是通过 channel 发送过来的,

,并不会出现多个协程往同一个文件里面写数据,文件操作模块主要集中于对日志文
件的分片管理,对历史日志打包

Jump to

Keyboard shortcuts

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