download

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mover

type Mover struct {
	FileMete     fileMete.Data // 文件元数据
	MoveDir      string        // 目标目录
	CurrentDir   string        // 文件所在目录
	RetryChannel chan int      // 重传channel通道
	MaxGtChannel chan struct{} // 限制上传的goroutine的数量通道
	StartTime    time.Time     // 移动开始时间
	EndTime      time.Time     // 移动结束时间
	RetrySlice   []int         // 需要重传分片编号
	// contains filtered or unexported fields
}

Mover 文件移动结构体

func NewMover

func NewMover(fileMete *fileMete.Data, ops ...OpFunc) *Mover

func (*Mover) DownloadFile

func (m *Mover) DownloadFile(url string) error

DownloadFile 从指定URL下载文件至本地路径

func (*Mover) GetMovePath

func (m *Mover) GetMovePath() string

func (*Mover) GetSlice

func (m *Mover) GetSlice(i int, offset, end int64, f *os.File)

GetSlice 该函数是直接将文件写入对应偏移量的。

func (*Mover) SliceDownload

func (m *Mover) SliceDownload(url string) error

type OpFunc

type OpFunc func(*Mover)

func WithCurrentDir

func WithCurrentDir(currentDir string) OpFunc

func WithMaxGtChannelSum

func WithMaxGtChannelSum(sum int) OpFunc

func WithMovePath

func WithMovePath(MoveDir string) OpFunc

func WithRetryChannelSum

func WithRetryChannelSum(sum int) OpFunc

Jump to

Keyboard shortcuts

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