file

package
v1.0.1006 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(fp string) error

创建文件夹

func FormatBytes

func FormatBytes(size int64) string

格式化数据大小

func FormatPath

func FormatPath(p string) string

格式化路径

func GetFilesMimeByFileName

func GetFilesMimeByFileName(filepath string) string

通过文件名获取文件mime信息

func GetFilesMimeByFp

func GetFilesMimeByFp(fp multipart.File) string

通过文件指针获取文件mime信息

func InsureDir

func InsureDir(path string) error

创建文件夹

func Md5

func Md5(filename string) (string, error)

文件 Md5

func Md5ForBig

func Md5ForBig(filename string) (string, error)

大文件 Md5

func Md5ForBigWithStream

func Md5ForBigWithStream(openfile File) (string, error)

大文件 Md5

func Md5WithStream

func Md5WithStream(openfile File) (string, error)

文件 Md5

func MustOpenFile

func MustOpenFile(fp string) *os.File

打开文件

func PackageName

func PackageName(v any) string

结构体路径

func ReadLine

func ReadLine(r *bufio.Reader) ([]byte, error)

func SearchFile

func SearchFile(filename string, paths ...string) (fullPath string, err error)

在目录里搜索文件

func SelfDir

func SelfDir() string

执行文件爱你目录

func SelfPath

func SelfPath() string

执行文件绝对路径

func Sha1

func Sha1(filename string) (string, error)

文件 Sha1

func Sha1ForBig

func Sha1ForBig(filename string) (string, error)

大文件 Sha1

func Sha1ForBigWithStream

func Sha1ForBigWithStream(openfile File) (string, error)

大文件 Sha1

func Sha1WithStream

func Sha1WithStream(openfile File) (string, error)

文件 Sha1

func StructName

func StructName(name any) string

获取结构体名称

func StructRealName

func StructRealName(name any) string

获取结构体真实名称

func ToBytes

func ToBytes(filePath string) ([]byte, error)

func ToInt64

func ToInt64(filePath string) (int64, error)

func ToString

func ToString(filePath string) (string, error)

func ToTrimString

func ToTrimString(filePath string) (string, error)

func ToUint64

func ToUint64(filePath string) (uint64, error)

func WriteBytes

func WriteBytes(filePath string, b []byte) (n int, err error)

func WriteFile

func WriteFile(filename string, contents string, flag ...int) (int, error)

写入文件

func WriteString

func WriteString(filePath string, s string) (int, error)

Types

type File

type File interface {
	io.Reader
}

stream 使用接口

Jump to

Keyboard shortcuts

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