utils

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExtensionFromUrl

func AddExtensionFromUrl(filename string, url string) string

func AddSuffixToNameBeforeExtension

func AddSuffixToNameBeforeExtension(prefix, path string) string

func GetActualPath

func GetActualPath(dir, path string) string

GetActualPath 由相对路径得到绝对路径

func GetDirFromPath

func GetDirFromPath(path string) string

func GetExtensionFromURL added in v1.0.5

func GetExtensionFromURL(url string) string

func GetFileLastModifyTime

func GetFileLastModifyTime(path, format string) string

func GetFileNameFromURL

func GetFileNameFromURL(url string) string

func GetFileType

func GetFileType(fSrc []byte) string

GetFileType 用文件前面几个字节来判断 fSrc: 文件字节流(就用前面几个字节) 返回文件后缀类型,不包含点

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func IsImage

func IsImage(bytes []byte) bool

func IsImageExist

func IsImageExist(path string) bool

func IsPathLegal

func IsPathLegal(path string) bool

func IsSameImage

func IsSameImage(path string, bytes []byte) bool

func IsSupportedImageExt added in v1.0.9

func IsSupportedImageExt(ext string) bool

IsSupportedImageExt 返回是否支持此图片后缀

func JoinPath

func JoinPath(path string, name string) string

JoinPath 将路径与路径/文件名连接起来

func MakeErrorResp

func MakeErrorResp(w *http.ResponseWriter, msg string)

func MakeResp

func MakeResp(w *http.ResponseWriter, code int, msg string)

func MakeSuccessResp

func MakeSuccessResp(w *http.ResponseWriter, data interface{})

func ReName

func ReName(src, dst string) bool

func Remove

func Remove(path string) bool

func SaveToDisk

func SaveToDisk(file multipart.File, path string) bool

func SetAllowCROS

func SetAllowCROS(w *http.ResponseWriter)

func ToJSONStr added in v1.0.8

func ToJSONStr(i interface{}) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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