dir

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile

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

添加文本

func Basename

func Basename(fp string) string

Basename 从路径中提取文件名

func Dir

func Dir(fp string) string

Dir 从路径中获取目录路径

func DirsUnder

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

list dirs under dirPath

func FilesUnder

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

list files under dirPath

func GetCurrentAbPath

func GetCurrentAbPath() string

GetCurrentAbPath 项目根目录绝对路径

func GetCurrentAbPathByExecutable

func GetCurrentAbPathByExecutable() string

GetCurrentAbPathByExecutable 当前执行文件目录

func GetCurrentFuncNameByCaller

func GetCurrentFuncNameByCaller() string

GetCurrentFuncNameByCaller 当前方法执行函数名

func InsureDir

func InsureDir(fp string) error

InsureDir 新建不存在的文件夹

func IsExist

func IsExist(fp string) bool

IsExist 检测文件或者目录是否存在 不存在的时候将返回 fasle

func IsFile

func IsFile(fp string) bool

IsFile checks whether the path is a file, it returns false when it's a directory or does not exist.

func MD5

func MD5(file string) (string, error)

func Md5Byte

func Md5Byte(p []byte) (string, error)

func OpenLogFile

func OpenLogFile(fp string) (*os.File, error)

func ReadBytes

func ReadBytes(cpath string) ([]byte, error)

func ReadJson

func ReadJson(cpath string, cptr interface{}) error

func ReadString

func ReadString(cpath string) (string, error)

func ReadStringTrim

func ReadStringTrim(cpath string) (string, error)

func ReadYaml

func ReadYaml(cpath string, cptr interface{}) error

func RealPath

func RealPath(fp string) (string, error)

RealPath 基于构件执行文件的绝对文件路径

func Remove

func Remove(filename string) error

func SelfDir

func SelfDir() string

SelfDir 执行文件目录完整路径

func SelfPath

func SelfPath() string

SelfPath 完整的执行文件绝对路径

func WriteBytes

func WriteBytes(filePath string, b []byte) (int, error)

func WriteString

func WriteString(filePath, s string) (int, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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