file_manage

package
v0.0.0-...-d233a18 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileType

func CheckFileType(path string) (file_type string, mime string)

判断文件类型,返回文件类型字符串和MIME信息字符串

func CheckFileTypeByByte

func CheckFileTypeByByte(b []byte) (file_type string, mime string)

判断文件类型,返回文件类型字符串和MIME信息字符串

func CheckFileTypeByMultipart

func CheckFileTypeByMultipart(file *multipart.FileHeader) (file_type string, mime string)

判断文件类型,返回文件类型字符串和MIME信息字符串

func CreateFolder

func CreateFolder(folder string) error

创建目录

func DeCryptString

func DeCryptString(enc string) ([]byte, error)

解密数据 使用默认码表,6位加密

func DeleteFile

func DeleteFile(file_path string)

删除文件(不返回错误,输出错误消息)

func EnCryptToString

func EnCryptToString(src string) string

加密数据 使用默认码表,6位加密

func FileSize

func FileSize(path string) int64

获取文件的大小,单位字节

func FormatFileSize

func FormatFileSize(fileSize int64, unit string) string

字节的单位转换,保留两位小数,将字节数转换为指定的单位(指定单位必须大写字母) B,KB,MB,GB,TB,EB

func FormatFileSizeToString

func FormatFileSizeToString(fileSize int64) (size string)

字节的单位转换,保留两位小数,将字节数转换为带单位的字符串

func GetFileCachePathString

func GetFileCachePathString(input_str string) (uri string, uri_md5 string, head_uri string)

生成文件对应的缓存目录相关字符串,专属函数

func GetFileMD5

func GetFileMD5(file *multipart.FileHeader) (string, error)

根据文件资源来获取文件的MD5值

func GetFileMD5ByPath

func GetFileMD5ByPath(filepath string) (string, error)

根据文件路径来获取文件的MD5值

func GetFilePathString

func GetFilePathString() string

生成对应目录的文件存储路径字符串

func IsDir

func IsDir(path string) bool

判断所给路径是否为文件夹

func IsFile

func IsFile(path string) bool

判断所给路径是否为文件

func IsImage

func IsImage(path string) bool

判断文件是不是图片,返回布尔值

func ListDirFileNumber

func ListDirFileNumber(folder string) int

遍历文件夹统计文件夹获取文件夹下的文件数量

func ListDirSize

func ListDirSize(folder string)

遍历文件夹统计文件夹使用量

func PathExists

func PathExists(path string) (bool, error)

判断文件或路径是否存在

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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