Documentation
¶
Index ¶
- type ChunkUpload
- func (cu *ChunkUpload) ChunkPath(index int) string
- func (cu *ChunkUpload) ChunkReceived(index int) bool
- func (cu *ChunkUpload) Cleanup() error
- func (cu *ChunkUpload) Merge() error
- func (cu *ChunkUpload) MergePath() string
- func (cu *ChunkUpload) ReceivedChunks() []int
- func (cu *ChunkUpload) SaveChunk(index int, reader io.Reader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChunkUpload ¶
type ChunkUpload struct {
UploadID string // 上传会话 ID
FileName string // 原始文件名
FilePath string // 最终存储路径
ChunkSize int64 // 每片大小
TotalSize int64 // 文件总大小
ChunkNum int // 总分片数
// contains filtered or unexported fields
}
ChunkUpload 分片上传管理器
func NewChunkUpload ¶
func NewChunkUpload(uploadID, fileName, filePath, tempDir string, totalSize int64, chunkSize int64) *ChunkUpload
NewChunkUpload 初始化分片上传
func (*ChunkUpload) ChunkPath ¶
func (cu *ChunkUpload) ChunkPath(index int) string
ChunkPath 返回第 index 片文件的临时路径
func (*ChunkUpload) ChunkReceived ¶
func (cu *ChunkUpload) ChunkReceived(index int) bool
ChunkReceived 检查第 index 片是否已上传
func (*ChunkUpload) ReceivedChunks ¶
func (cu *ChunkUpload) ReceivedChunks() []int
ReceivedChunks 返回已接收的分片索引列表
Click to show internal directories.
Click to hide internal directories.