helper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string, overwrite bool, perm os.FileMode, copyAttr bool) error

CopyFile 复制文件,可设置是否覆盖,可设置文件权限,可设置是否复制文件属性

func CopyFileAttr

func CopyFileAttr(src, dst string) error

CopyFileAttr 复制文件属性

func CreateFileIfNotExist

func CreateFileIfNotExist(path string, content []byte, perm os.FileMode, overwrite bool) error

CreateFileIfNotExist 判断文件是否存在,不存在则根据传入的文件内容创建,可设置文件权限,可设置是否覆盖

func DirExists

func DirExists(path string, create bool, perm os.FileMode) (bool, error)

DirExists 判断目录是否存在

func DirName

func DirName(path string) string

DirName 获取目录部分

func FileExists

func FileExists(path string) bool

FileExists 检查文件是否存在

func GetAbsPath

func GetAbsPath(path string) (string, error)

GetAbsPath 获取绝对路径

func IsDir

func IsDir(path string) bool

IsDir 判断是否是目录

func IsEmpty

func IsEmpty(path string) bool

IsEmpty 判断文件或目录是否为空

func IsEmptyDir

func IsEmptyDir(path string) bool

IsEmptyDir 判断目录是否为空

func IsEmptyFile

func IsEmptyFile(path string) bool

IsEmptyFile 判断文件是否为空

func IsExecutable

func IsExecutable(path string) bool

IsExecutable 判断文件是否可执行

func IsFile

func IsFile(path string) bool

IsFile 判断是否是文件

func IsHidden

func IsHidden(path string) bool

IsHidden 判断文件是否隐藏

func IsReadable

func IsReadable(path string) bool

IsReadable 判断文件是否可读

func IsSymlink(path string) bool

IsSymlink 判断是否是软链接

func IsWritable

func IsWritable(path string) bool

IsWritable 判断文件是否可写

func ParseIP

func ParseIP(s string) (net.IP, int)

ParseIP 解析IP地址,输出是ipv4或ipv6 0: invalid ip 4: ipv4 6: ipv6

func ReadJsonFile

func ReadJsonFile(filePath string, data any) error

ReadJsonFile 读取json文件,并解析到结构体

func Remove

func Remove(path string) error

Remove 删除文件或目录

Types

This section is empty.

Jump to

Keyboard shortcuts

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