Documentation
¶
Index ¶
- func DownloadHandler(ctx context.Context, w http.ResponseWriter, storage DownloadStorager, ...) (err error)
- func FromDownloadFilenameContext(ctx context.Context) (filename string, ok bool)
- func GetMultipartFileSize(file multipart.File) (size int64, err error)
- func NewDownloadBeforeContext(ctx context.Context, f DownloadBeforeFunc) context.Context
- func NewDownloadFilenameContext(ctx context.Context, filename string) context.Context
- func NewIncomingContext(ctx context.Context, md Metadata) context.Context
- func NewRenameContext(ctx context.Context, f RenameFunc) context.Context
- type DefaultDownloadStorage
- type DefaultStorage
- func (ds *DefaultStorage) Download(ctx context.Context, writer io.Writer, filename string) (info DownloadFileInfoer, err error)
- func (ds *DefaultStorage) Exist(ctx context.Context, filename string) (exist bool, err error)
- func (ds *DefaultStorage) Remove(ctx context.Context, filename string) (err error)
- func (ds *DefaultStorage) Upload(ctx context.Context, reader io.Reader, filename string) (fullName string, err error)
- type DefaultUploadStorage
- type DownloadBeforeFunc
- type DownloadFileInfoer
- type DownloadStorager
- type Downloader
- type Exister
- type Metadata
- type Remover
- type RenameFunc
- type Storager
- type UploadFileInfoer
- type UploadStorager
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadHandler ¶
func DownloadHandler(ctx context.Context, w http.ResponseWriter, storage DownloadStorager, filename string) (err error)
func GetMultipartFileSize ¶
GetMultipartFileSize 获取上传文件大小 相关问题:https://github.com/golang/go/issues/19501
func NewDownloadBeforeContext ¶
func NewDownloadBeforeContext(ctx context.Context, f DownloadBeforeFunc) context.Context
func NewRenameContext ¶
func NewRenameContext(ctx context.Context, f RenameFunc) context.Context
Types ¶
type DefaultDownloadStorage ¶
type DefaultDownloadStorage struct { *DefaultStorage // contains filtered or unexported fields }
func NewDefaultDownloadStorage ¶
func NewDefaultDownloadStorage(dispositionType string) *DefaultDownloadStorage
func (*DefaultDownloadStorage) DispositionType ¶
func (ds *DefaultDownloadStorage) DispositionType() string
type DefaultStorage ¶
type DefaultStorage struct {
BasePath string
}
func NewDefaultStorage ¶
func NewDefaultStorage() *DefaultStorage
func (*DefaultStorage) Download ¶
func (ds *DefaultStorage) Download(ctx context.Context, writer io.Writer, filename string) (info DownloadFileInfoer, err error)
type DefaultUploadStorage ¶
type DefaultUploadStorage struct {
*DefaultStorage
}
func NewDefaultUploadStorage ¶
func NewDefaultUploadStorage() *DefaultUploadStorage
func (*DefaultUploadStorage) MaxMemory ¶
func (ds *DefaultUploadStorage) MaxMemory() int64
type DownloadBeforeFunc ¶
type DownloadBeforeFunc func(info DownloadFileInfoer)
func FromDownloadBeforeContext ¶
func FromDownloadBeforeContext(ctx context.Context) (f DownloadBeforeFunc, ok bool)
type DownloadFileInfoer ¶
type DownloadStorager ¶
type DownloadStorager interface { Downloader DispositionType() string }
type Downloader ¶
type RenameFunc ¶
func FromRenameContext ¶
func FromRenameContext(ctx context.Context) (f RenameFunc, ok bool)
type UploadFileInfoer ¶
type UploadFileInfoer interface { FullName() string Filename() string Size() int64 Header() textproto.MIMEHeader }
func UploadHandler ¶
func UploadHandler(ctx context.Context, r *http.Request, storage UploadStorager, name string) (infos []UploadFileInfoer, err error)
type UploadStorager ¶
Click to show internal directories.
Click to hide internal directories.