fileutil

package
v0.0.0-...-1fbfbf2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearDir

func ClearDir(dirPath string) error

ClearDir 清空目录下所有文件不包括子目录.

func ClearDirF

func ClearDirF(dirPath string) error

ClearDirF 清空目录下所有文件和目录.

func Copy

func Copy(sourcePath, targetPath string) error

Copy 复制文件

func CreateFile

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

CreateFile 创建或清空文件

func Download

func Download(sourceUrl, targetPath string) error

Download 下载文件

func GetAllFiles

func GetAllFiles(dirPath string) ([]string, error)

GetAllFiles 获取指定目录下的所有文件路径

func IsDir

func IsDir(filePath string) bool

IsDir 判断目录是否存在.

func IsEmpty

func IsEmpty(dirname string) bool

IsEmpty 判断目录是否为空.

func IsExist

func IsExist(filePath string) bool

IsExist 判断文件或目录是否存在.

func IsFile

func IsFile(filePath string) bool

IsFile 判断文件是否存在.

func ListIndex

func ListIndex(dirPath string) ([]string, []string, error)

ListIndex 目录下文件名和子目录名列表.

func MkDir

func MkDir(dirPath string) error

MkDir 创建目录.

func Name

func Name(filePath string) string

Name 获取文件名.

func ReadFileToBytes

func ReadFileToBytes(filePath string) ([]byte, error)

ReadFileToBytes 读文件

func ReadHttpFileToBytes

func ReadHttpFileToBytes(fileUrl string) ([]byte, error)

ReadHttpFileToBytes 读网络文件

func RemoveDir

func RemoveDir(dirPath string) error

RemoveDir 删除空目录.

func SelfDir

func SelfDir() string

SelfDir gets compiled executable file directory.

func SelfPath

func SelfPath() string

SelfPath gets compiled executable file absolute path.

func WriteBytesToFile

func WriteBytesToFile(filePath string, b []byte) error

WriteBytesToFile 写文件 覆盖

Types

This section is empty.

Jump to

Keyboard shortcuts

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