Documentation
¶
Overview ¶
Package dashfile
文件及文件夹相关工具
File and folder related tools
Index ¶
- func AppendFile(srcFilePath, dstFilePath string) (writeen int, err error)
- func CompareFileBySum(filePath1, filePath2 string) bool
- func CopyFile(srcFilePath, dstFilePath string) (writeen int64, err error)
- func CreateOrOpen(filePath string) (*os.File, error)
- func CreateOrReset(filePath string) (*os.File, error)
- func GetFileList(path string) ([]string, error)
- func GetFileListAccept(path string, accept []string) ([]string, error)
- func GetFileListExcept(path string, except []string) ([]string, error)
- func GetFileListFilter(path string, accept, except []string) ([]string, error)
- func GetLastDir(path string) string
- func GetLastDirWithCheck(path string) (string, error)
- func IsDir(path string) bool
- func IsExist(path string) bool
- func IsFile(path string) bool
- func OpenFile(filePath string) (*os.File, error)
- func ReadByFile(file *os.File) ([]byte, error)
- func ReadByFilePath(filePath string) ([]byte, error)
- func RemoveAll(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶
CopyFile @Editor robotyang at 2023
CopyFile 从src文件 读取内容 追加到 dst文件 ¶
@Param srcFilePath 来源文件路径
@Param dstFilePath 目标文件路径:文件存在则覆盖,不存在则创建
func CompareFileBySum ¶
CompareFileBySum @Editor robotyang at 2023
CompareFileBySum 通过计算文件签名,判断两个文件是否一致 ¶
func CopyFile ¶
CopyFile @Editor robotyang at 2023
CopyFile 从src文件 读取内容 拷贝到 dst文件 ¶
@Param srcFilePath 来源文件路径
@Param dstFilePath 目标文件路径:文件存在则覆盖,不存在则创建
func CreateOrOpen ¶
CreateOrOpen @Editor robotyang at 2023
CreateOrOpen 重建或打开文件(会自动创建目录,文件存在则打开,不存在则创建) ¶
func CreateOrReset ¶
CreateOrReset @Editor robotyang at 2023
CreateOrReset 重建文件(会自动创建目录,文件存在则清空,不存在则创建) ¶
func GetFileListFilter ¶
GetFileListFilter @Editor robotyang at 2023
GetFileListFilter 递归获取目录下的所有子文件(排除清单except > 保留清单accept) ¶
func GetLastDirWithCheck ¶
GetLastDirWithCheck @Editor robotyang at 2023
GetLastDirWithCheck 先检查路径资源是否存在,存在则获取 最后一个目录名 ¶
func ReadByFilePath ¶
ReadByFilePath @Editor robotyang at 2023
ReadByFilePath 读取文件内容 ¶
@ @Editor robotyang at 2023
@Reference https://haicoder.net/golang/golang-read.html ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.