utils

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 20 Imported by: 0

README

utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeUrlParams

func ChangeUrlParams(urlStr string, values ...interface{}) (string, error)

func CopyFile

func CopyFile(srcName, dstName string) (written int64, err error)

func FileGetContents

func FileGetContents(filename string) string

func GenerateFileHash

func GenerateFileHash(filepath string) (string, error)

generateFileHash 生成文件hash

func GenerateHash

func GenerateHash(message []byte) string

generateHash 生成数据hash

func IsDirExists

func IsDirExists(path string) bool

The IsDirExists judges path is directory or not.

func IsFileExists

func IsFileExists(path string) bool

The IsFileExists judges path is file or not.

func ReadFile

func ReadFile(filePath string) string

func Unzip

func Unzip(zipFile, dst string) error

func UnzipFromBytes

func UnzipFromBytes(b []byte, dst string) error

func UnzipFromReader

func UnzipFromReader(reader *zip.Reader, dst string) error

func Zip

func Zip(dst string, files ...string) error

zip path

func ZipFilesToWrite

func ZipFilesToWrite(w1 io.Writer, fileList *[]string, pathNames map[string]string) error

Types

type BasicFileInfo

type BasicFileInfo struct {
	Filepath string

	Info fs.FileInfo
	// contains filtered or unexported fields
}

BasicFileInfo 收集文件基本信息

func GetBasicFileInfo

func GetBasicFileInfo(pathToFile string) (*BasicFileInfo, error)

GetBasicFileInfo 获取文件基本信息

func (*BasicFileInfo) Ext

func (bfi *BasicFileInfo) Ext() string

func (*BasicFileInfo) Hash

func (bfi *BasicFileInfo) Hash() string

func (*BasicFileInfo) IsDir

func (bfi *BasicFileInfo) IsDir() bool

func (*BasicFileInfo) MIME

func (bfi *BasicFileInfo) MIME() string

func (*BasicFileInfo) ModTime

func (bfi *BasicFileInfo) ModTime() time.Time

func (*BasicFileInfo) Mode

func (bfi *BasicFileInfo) Mode() fs.FileMode

func (*BasicFileInfo) Name

func (bfi *BasicFileInfo) Name() string

func (*BasicFileInfo) Path

func (bfi *BasicFileInfo) Path() string

func (*BasicFileInfo) Size

func (bfi *BasicFileInfo) Size() int64

func (*BasicFileInfo) Sys

func (bfi *BasicFileInfo) Sys() any

type UploadFile

type UploadFile struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Parent  string `json:"parent"`
	IsDir   bool   `json:"is_dir"`
	Mode    string `json:"mode"`
	ModTime string `json:"mod_time"`
	Size    string `json:"size"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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