file

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAllLine

func AppendAllLine(filePath string, contents []string)

AppendAllLine 换行追加文件 filePath:文件路径 contents:文件内容

func AppendLine

func AppendLine(filePath string, content string)

AppendLine 换行追加文件 filePath:文件路径 content:文件内容

func AppendString

func AppendString(filePath string, content string)

AppendString 追加文件 filePath:文件路径 content:文件内容

func ClearFile

func ClearFile(path string)

ClearFile 清空目录下的所有文件(但不删除path目录本身) path:目录路径

func CopyFile

func CopyFile(srcName string, destName string)

CopyFile 复制文件 srcName 复制的原文件 destName 复制到目标位置(需带上文件名)

func CopyFolder

func CopyFolder(srcPath string, destPath string)

CopyFolder 复制整个文件夹 srcPath 要复制的原目录路径 destPath 复制到位置的目录路径

func CreateDir

func CreateDir(path string, perm os.FileMode)

CreateDir 创建所有目录 path:目录 perm:目录权限

func CreateDir766

func CreateDir766(path string)

CreateDir766 创建所有目录,权限为766 path:目录

func Delete

func Delete(filePath string)

Delete 删除文件 filePath:文件路径

func GetFiles

func GetFiles(path string, searchPattern string, searchSubDir bool) []string

GetFiles 读取指定目录下的文件 path:目录路径 searchPattern:匹配文件名要包含的名称,搜索全部,传入""即可 searchSubDir:是否要搜索子目录

func IsExists

func IsExists(path string) bool

IsExists 判断路径是否存在 path:目录路径

func ReadAllLines

func ReadAllLines(filePath string) []string

ReadAllLines 读文件内容,按行返回数组 filePath:文件路径

func ReadString

func ReadString(filePath string) string

ReadString 读文件内容 filePath:文件路径

func WriteString

func WriteString(filePath string, content string)

WriteString 写入文件 filePath:文件路径 content:文件内容

Types

This section is empty.

Jump to

Keyboard shortcuts

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