ioUtil

package
v0.0.0-...-e50112c Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(srcPath, destPath string) error

func DupStderr

func DupStderr(filename string, onResult func(err error))

DupStderr 重定向 stderr 到指定文件。主要用于捕获进程异常退出的Panic日志信息

func GZipTar

func GZipTar(filePath string, w io.Writer, removeSrcFile ...bool) (err error)

GZipTar gzip 压缩打包

filename 打包的文件/文件夹
w 写入的文件流
removeSrcFile 打包成功后删除打包的文件/文件夹 true.删除

func GZipTarToFile

func GZipTarToFile(filePath string, targetPath string, removeSrcFile ...bool) error

GZipTarToFile gzip 压缩打包到文件

filePath 打包的文件/文件夹
targetPath 打包后的文件路径
removeSrcFile 打包成功后删除打包的文件/文件夹 true.删除

func IsDirExists

func IsDirExists(dir string) bool

func IsFileExists

func IsFileExists(path string) bool

func MakeDir

func MakeDir(dir string) error

func Move

func Move(oldPath, newPath string) error

Move 移动文件 首先通过os.Rename移动,移动失败,再尝试通过读文件内容Copy的方式移动

func OpenFile

func OpenFile(filename string, flags ...int) (*os.File, error)

OpenFile 打开文件,如果文件不存在 或者 上层文件夹不存在,都进行创建

filename 文件名称
flags 打开文件模式,默认 追加读写

func UnGZipTarF

func UnGZipTarF(r io.Reader, f func(h *tar.Header, r io.Reader) error) error

UnGZipTarF gzip 解压文件流

r gzip压缩文件流
f 回调解压后的文件流 如果是文件夹,r 为nil

func UnGZipTarFileF

func UnGZipTarFileF(filePath string, f func(h *tar.Header, r io.Reader) error, removeSrcFile ...bool) error

UnGZipTarFileF gzip 解压文件流

filePath gzip压缩文件
f 回调解压后的文件流 如果是文件夹,r 为nil
removeSrcFile 解压成功后删除压缩文件 true.删除

func UnGZipTarFileToDir

func UnGZipTarFileToDir(filePath string, dir string, removeSrcFile ...bool) error

UnGZipTarFileToDir gzip解压文件到目录

filePath gzip压缩文件
dir 解压到文件夹
removeSrcFile 解压成功后删除压缩文件 true.删除

func UnGZipTarToDir

func UnGZipTarToDir(r io.Reader, dir string) error

UnGZipTarToDir gzip解压文件流到目录

r gzip压缩文件流
dir 解压到文件夹

func WriteFile

func WriteFile(filename string, data []byte, perm os.FileMode) error

func WriteFileF

func WriteFileF(filename string, perm os.FileMode, f func(f *os.File) error) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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