Documentation ¶
Index ¶
- Constants
- Variables
- func Exist(filePath string) bool
- func FilePath(relativePath string) string
- func PublicPath(relativePath string) string
- func RelativePath(prePath, b58hash string, includeFile bool) string
- type Format
- func (z *Format) DecodeMsg(dc *msgp.Reader) (err error)
- func (z Format) EncodeMsg(en *msgp.Writer) (err error)
- func (f Format) FileExt() string
- func (f Format) IsImage() bool
- func (z Format) MarshalMsg(b []byte) (o []byte, err error)
- func (z Format) Msgsize() (s int)
- func (z *Format) UnmarshalMsg(bts []byte) (o []byte, err error)
- type VaidateConfig
Constants ¶
View Source
const ( NONE = Format(iota) GIF JPG PNG WEBP )
Variables ¶
View Source
var ( ErrContentType = errors.New("invalid-content-type") ErrSomethingWentWrong = errors.New(apierr.SomethingWentWrong.String()) ErrFileSize = errors.New("invalid-file-size") )
View Source
var (
ImageContentTypes = []string{"image/png", "image/jpeg", "image/gif", "image/webp"}
)
Functions ¶
func PublicPath ¶
func RelativePath ¶
Types ¶
type Format ¶
type Format int
func ContentTypeToFormat ¶
func ExtensionToFormat ¶
func (Format) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type VaidateConfig ¶
func NewVaidateConfig ¶
func NewVaidateConfig(maxSize int64, contentTypes ...string) *VaidateConfig
func (*VaidateConfig) ContentType ¶
func (vc *VaidateConfig) ContentType(contentType string) error
func (*VaidateConfig) MpFileHeader ¶
func (vc *VaidateConfig) MpFileHeader(fileHead *multipart.FileHeader) error
func (*VaidateConfig) Size ¶
func (vc *VaidateConfig) Size(size int64) error
Click to show internal directories.
Click to hide internal directories.