2019-11-16 13:37:42 +08:00
|
|
|
package local
|
|
|
|
|
2019-11-17 19:12:10 +08:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
)
|
2019-11-16 13:37:42 +08:00
|
|
|
|
2019-11-23 15:09:46 +08:00
|
|
|
// FileStream 用户传来的文件
|
2019-11-17 19:12:10 +08:00
|
|
|
type FileStream struct {
|
2019-11-19 16:42:36 +08:00
|
|
|
File io.ReadCloser
|
|
|
|
Size uint64
|
|
|
|
VirtualPath string
|
|
|
|
Name string
|
|
|
|
MIMEType string
|
2019-11-17 19:12:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (file FileStream) Read(p []byte) (n int, err error) {
|
|
|
|
return file.File.Read(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (file FileStream) GetMIMEType() string {
|
|
|
|
return file.MIMEType
|
|
|
|
}
|
|
|
|
|
|
|
|
func (file FileStream) GetSize() uint64 {
|
|
|
|
return file.Size
|
|
|
|
}
|
|
|
|
|
|
|
|
func (file FileStream) Close() error {
|
|
|
|
return file.File.Close()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (file FileStream) GetFileName() string {
|
|
|
|
return file.Name
|
|
|
|
}
|
2019-11-19 16:42:36 +08:00
|
|
|
|
|
|
|
func (file FileStream) GetVirtualPath() string {
|
|
|
|
return file.VirtualPath
|
|
|
|
}
|