fsctx

package
v3.0.0-...-3edb00a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: GPL-3.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// GinCtx Gin的上下文
	GinCtx key = iota
	// PathCtx 文件或目录的虚拟路径
	PathCtx
	// FileModelCtx 文件数据库模型
	FileModelCtx
	// FolderModelCtx 目录数据库模型
	FolderModelCtx
	// HTTPCtx HTTP请求的上下文
	HTTPCtx
	// UploadPolicyCtx 上传策略,一般为slave模式下使用
	UploadPolicyCtx
	// UserCtx 用户
	UserCtx
	// ThumbSizeCtx 缩略图尺寸
	ThumbSizeCtx
	// FileSizeCtx 文件大小
	FileSizeCtx
	// ShareKeyCtx 分享文件的 HashID
	ShareKeyCtx
	// LimitParentCtx 限制父目录
	LimitParentCtx
	// IgnoreDirectoryConflictCtx 忽略目录重名冲突
	IgnoreDirectoryConflictCtx
	// RetryCtx 失败重试次数
	RetryCtx
	// ForceUsePublicEndpointCtx 强制使用公网 Endpoint
	ForceUsePublicEndpointCtx
	// CancelFuncCtx Context 取消函數
	CancelFuncCtx
	// 文件在从机节点中的路径
	SlaveSrcPath
	// Webdav目标名称
	WebdavDstName
	// WebDAVCtx WebDAV
	WebDAVCtx
	// WebDAV反代Url
	WebDAVProxyUrlCtx
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHeader

type FileHeader interface {
	io.Reader
	io.Closer
	io.Seeker
	Info() *UploadTaskInfo
	SetSize(uint64)
	SetModel(fileModel interface{})
	Seekable() bool
}

FileHeader 上传来的文件数据处理器

type FileStream

type FileStream struct {
	Mode            WriteMode
	LastModified    *time.Time
	Metadata        map[string]string
	File            io.ReadCloser
	Seeker          io.Seeker
	Size            uint64
	VirtualPath     string
	Name            string
	MimeType        string
	SavePath        string
	UploadSessionID *string
	AppendStart     uint64
	Model           interface{}
	Src             string
}

FileStream 用户传来的文件

func (*FileStream) Close

func (file *FileStream) Close() error

func (*FileStream) Info

func (file *FileStream) Info() *UploadTaskInfo

func (*FileStream) Read

func (file *FileStream) Read(p []byte) (n int, err error)

func (*FileStream) Seek

func (file *FileStream) Seek(offset int64, whence int) (int64, error)

func (*FileStream) Seekable

func (file *FileStream) Seekable() bool

func (*FileStream) SetModel

func (file *FileStream) SetModel(fileModel interface{})

func (*FileStream) SetSize

func (file *FileStream) SetSize(size uint64)

type UploadTaskInfo

type UploadTaskInfo struct {
	Size            uint64
	MimeType        string
	FileName        string
	VirtualPath     string
	Mode            WriteMode
	Metadata        map[string]string
	LastModified    *time.Time
	SavePath        string
	UploadSessionID *string
	AppendStart     uint64
	Model           interface{}
	Src             string
}

func (*UploadTaskInfo) DetectMimeType

func (u *UploadTaskInfo) DetectMimeType() string

Get mimetype of uploaded file, if it's not defined, detect it from file name

type WriteMode

type WriteMode int
const (
	Overwrite WriteMode = 0x00001
	// Append 只适用于本地策略
	Append WriteMode = 0x00002
	Nop    WriteMode = 0x00004
)

Jump to

Keyboard shortcuts

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