local

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExtErr              = errors.New("file suffix is not supported")
	FileSizeErr         = errors.New("exceeded maximum file limit")
	CreatePathErr       = errors.New("failed to create save directory")
	CompetenceErr       = errors.New("insufficient file permissions")
	RepeatedFileTypeErr = errors.New("DuplicateFileType")
)
View Source
var UploadManager = make(uploadManager)

Functions

func CheckSavePath

func CheckSavePath(dst string) bool

CheckSavePath 检查保存目录是否存在

func GetFileExt

func GetFileExt(name string) string

GetFileExt 获取后缀

func GetFileName

func GetFileName(fileName string) (string, string)

GetFileName 加密文件名

func Init

func Init(typeors ...FileTypeor)

func SaveFile

func SaveFile(fileType FileType, fileHeader *multipart.FileHeader) (string, error)

Types

type File

type File struct {
	Type      FileType
	Suffix    []string
	MaxSize   int
	UrlPrefix string
	LocalPath string
}

func NewFile

func NewFile(filetype FileType, suffix []string, maxSize int, urlPrefix string, localpath string) *File

func (*File) GetMaxSize

func (f *File) GetMaxSize() int

func (*File) GetPath

func (f *File) GetPath() string

func (*File) GetSuffix

func (f *File) GetSuffix() []string

func (*File) GetType

func (f *File) GetType() FileType

func (*File) GetUrlPrefix

func (f *File) GetUrlPrefix() string

type FileType

type FileType string

type FileTypeor

type FileTypeor interface {
	GetType() FileType
	GetSuffix() []string
	GetMaxSize() int
	GetUrlPrefix() string
	GetPath() string
}

Jump to

Keyboard shortcuts

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