chunk

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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) Cleanup

func (cu *ChunkUpload) Cleanup() error

Cleanup 删除所有临时分片文件

func (*ChunkUpload) Merge

func (cu *ChunkUpload) Merge() error

Merge 将所有分片合并为一个文件

func (*ChunkUpload) MergePath

func (cu *ChunkUpload) MergePath() string

MergePath 返回合并后的文件临时路径

func (*ChunkUpload) ReceivedChunks

func (cu *ChunkUpload) ReceivedChunks() []int

ReceivedChunks 返回已接收的分片索引列表

func (*ChunkUpload) SaveChunk

func (cu *ChunkUpload) SaveChunk(index int, reader io.Reader) error

SaveChunk 保存一片分片

Jump to

Keyboard shortcuts

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