Documentation ¶
Overview ¶
* @Author: NyanCatda * @Date: 2022-03-08 21:26:55 * @LastEditTime: 2022-03-22 23:21:11 * @LastEditors: NyanCatda * @Description: 路径检查 * @FilePath: \Momizi\Tools\File\Dir.go
* @Author: NyanCatda * @Date: 2022-03-22 22:10:18 * @LastEditTime: 2022-03-22 23:21:06 * @LastEditors: NyanCatda * @Description: 文件操作 * @FilePath: \Momizi\Tools\File\File.go
* @Author: NyanCatda * @Date: 2022-03-28 13:24:47 * @LastEditTime: 2022-03-28 13:52:20 * @LastEditors: NyanCatda * @Description: 文件类型判断 * @FilePath: \Momizi\Tools\File\FileType.go
* @Author: NyanCatda * @Date: 2022-03-23 13:59:28 * @LastEditTime: 2022-04-02 02:57:34 * @LastEditors: McPlus * @Description: 文件读写操作 * @FilePath: \Momizi\Tools\File\ReadWrite.go
Index ¶
- func Copy(Path string, NewPath string) (int64, error)
- func CorrectFileType(Path string) (string, error)
- func Delete(Path string) (bool, error)
- func Exists(Path string) bool
- func GetFileSize(FilePath string) (int64, error)
- func GetFileType(FileBody []byte) string
- func GetFilesList(DirPth string) ([]string, error)
- func IsDir(Path string) bool
- func IsFile(Path string) bool
- func MKDir(Path string) (bool, error)
- func Move(Path string, NewPath string) error
- type ReadWrite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
*
- @description: 复制文件
- @param {string} Path 源文件路径
- @param {string} NewPath 目标文件路径
- @return {int64} 文件大小(Byte)
- @return {error} 错误信息
func CorrectFileType ¶
*
- @description: 纠正文件类型
- @param {string} Path 文件路径
- @return {string} 纠正后的文件路径
- @return {error} 错误信息
func Delete ¶
*
- @description: 删除文件/文件夹
- @param {string} Path 文件/文件夹路径
- @return {bool} 是否删除成功
- @return {error} 错误信息
func GetFileSize ¶
*
- @description: 获取文件大小
- @param {string} FilePath 文件路径
- @return {int64} 文件大小(Byte)
- @return {error} 错误信息
func GetFilesList ¶
*
- @description: 遍历目录下的所有文件(包含子目录)
- @param {string} DirPth
- @return {[]string} 文件路径列表
- @return {error} 错误信息
Types ¶
type ReadWrite ¶
func (*ReadWrite) Read ¶
*
- @description: 读取文件(需要权限os.O_RDONLY)
- @return {string} 文件内容
- @return {error} 错误
func (*ReadWrite) WriteAppend ¶
*
- @description: 追加写入文件(需要权限os.O_WRONLY|os.O_APPEND|os.O_CREATE)
- @param {string} Content 文件内容
- @return {error} 错误