Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRequestDataType error = errors.New("Request data field type error") ErrUploadFileSize error = errors.New("Upload File size error") ErrRequestRestMethod error = errors.New("RESTful method error") ErrImageType error = errors.New("Type of file is not image") ErrPermission error = errors.New("error Permission") )
Functions ¶
func DetectContentType ¶
判断文件类型,检测前512字节数据,如果不能识别,返回"application/octet-stream"
func IsImageType ¶
Types ¶
type UploadFileMode ¶
type UploadFileMode struct { File multipart.File // 文件 FileName string // 文件名 Size int64 // 文件大小 Sha1 string // sha1值 ContentType string // 文件类型 }
获取到的文件
func NormalToUploadFile ¶
func NormalToUploadFile(p string, meta *UploadFileRequire) (res *UploadFileMode, err error)
普通文件转为UploadFileMode类型
func UploadFileOne ¶
func UploadFileOne(rw http.ResponseWriter, req *http.Request, meta *UploadFileRequire) (*UploadFileMode, error)
上传一个文件
func (*UploadFileMode) Close ¶
func (f *UploadFileMode) Close()
Directories ¶
Path | Synopsis |
---|---|
lib
|
|
go-uuid/uuid
The uuid package generates and inspects UUIDs.
|
The uuid package generates and inspects UUIDs. |
mapstructure
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure.
|
The mapstructure package exposes functionality to convert an abitrary map[string]interface{} into a native Go structure. |
mergo
Package mergo merges same-type structs and maps by setting default values in zero-value fields.
|
Package mergo merges same-type structs and maps by setting default values in zero-value fields. |
pbkdf2
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0.
|
Package pbkdf2 implements the key derivation function PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. |
resize
Package resize implements various image resizing methods.
|
Package resize implements various image resizing methods. |
scrypt
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf).
|
Package scrypt implements the scrypt key derivation function as defined in Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard Functions" (http://www.tarsnap.com/scrypt/scrypt.pdf). |
Click to show internal directories.
Click to hide internal directories.