Documentation
¶
Index ¶
- func CreateDir(dirName string, perm os.FileMode) error
- func CreateIfNotExist(dirName string, perm os.FileMode) (err error)
- func Delete(filePath string) error
- func DeleteFiles(filePaths []string) (err error)
- func DownloadFile(url string, localPath string, fb func(length, downLen int64)) error
- func DownloadFileFromContext(r *http.Request, fieldName, targetPath string) (fileName, filePath string, err error)
- func ExistSameNameFile(filename string) bool
- func ExistSameSizeFile(filename string, filesize int64) bool
- func GetFileBuf(uri string) []byte
- func GetFileNameFromLocalPath(localFilePath string) (targetDir, wholeName, fileName, fileType string)
- func GetFileString(uri string) string
- func IsDirExist(dirPath string) bool
- func ReadByteFromFile(filePath string) (byteData []byte, err error)
- func ReadJsonFile(filePath string, targetStruct interface{}) error
- func ReadJsonFileMap(filePath string) map[string]interface{}
- func SaveStringToFile(content string, filename string) error
- func SimpleDownloadFile(url string) (finalFilePath string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIfNotExist ¶ added in v1.5.6
CreateIfNotExist 如果目录不存在,则创建
func DeleteFiles ¶ added in v1.5.6
DeleteFiles 删除指定路径文件夹/文件
func DownloadFile ¶
DownloadFile 从url中下载文件
func DownloadFileFromContext ¶ added in v1.5.6
func DownloadFileFromContext(r *http.Request, fieldName, targetPath string) (fileName, filePath string, err error)
DownloadFileFromContext 从请求体中保存文件
func ExistSameNameFile ¶ added in v1.5.6
ExistSameNameFile 判断是否已存在同名文件
func ExistSameSizeFile ¶ added in v1.5.6
*
- @func: ExistFile 判断文件是否已存在
- @author Wiidz
- @date 2019-11-16
func GetFileBuf ¶
func GetFileNameFromLocalPath ¶ added in v1.5.6
func GetFileNameFromLocalPath(localFilePath string) (targetDir, wholeName, fileName, fileType string)
GetFileNameFromLocalPath 从本地路径中提取文件 localFilePath 应该是 /home/www/wwwroot/aaaaa.html 这样
func GetFileString ¶ added in v1.5.6
func IsDirExist ¶ added in v1.5.6
IsDirExist 判断目录是否存在 dirPath 绝对路径,不要以/结尾
func ReadByteFromFile ¶ added in v1.5.6
ReadByteFromFile 从文件中读取byte数据
func ReadJsonFile ¶
ReadJsonFile 读取json格式的文件
func ReadJsonFileMap ¶ added in v1.5.6
ReadJsonFileMap 读取json格式的文件
func SaveStringToFile ¶ added in v1.5.6
SaveStringToFile 将字符串输出到文件中
func SimpleDownloadFile ¶ added in v1.5.6
SimpleDownloadFile 简单下载(下载到当前工程目录的/tmp下,记得给权限)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.