filebase

package
v0.0.0-...-4b55cb2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNotExist

func CheckNotExist(src string) bool

CheckNotExist check if the file exists

func CheckPermission

func CheckPermission(src string) bool

CheckPermission check if the file has permission

func GetExt

func GetExt(fileName string) string

GetExt get the file ext

func GetImageName

func GetImageName(name string) string

GetImageName get image name

func GetSize

func GetSize(f multipart.File) (int, error)

GetSize get the file size

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir create a directory if it does not exist

func MkDir

func MkDir(src string) error

MkDir create a directory

func MustOpen

func MustOpen(fileName, filePath string) (*os.File, error)

MustOpen maximize trying to open the file

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open a file according to a specific mode

Types

type Image

type Image struct {
	PrefixUrl string
	RootPath  string
	AllowExts []string
	MaxSize   int
}

func (*Image) CheckImage

func (i *Image) CheckImage(src string) error

CheckImage check if the file exists

func (*Image) CheckImageExt

func (i *Image) CheckImageExt(fileName string) bool

CheckImageExt check image file ext

func (*Image) CheckImageSize

func (i *Image) CheckImageSize(f multipart.File) bool

CheckImageSize check image size

func (*Image) GetImageFullUrl

func (i *Image) GetImageFullUrl(name string) string

GetImageFullUrl get the full access path

func (*Image) GetImagePath

func (i *Image) GetImagePath() string

GetImagePath get save path

Jump to

Keyboard shortcuts

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