Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader struct { FileSize int Link string FilePath string TotalPart int //下载线程 DoneFilePart []Part PartSize int PartCoroutineNum int //分片下载协程数 }
FileDownloader 文件下载器
func NewFileDownloader ¶
func NewFileDownloader(downloadLink, filePath string) *Downloader
NewFileDownloader .
func (*Downloader) Download ¶
func (d *Downloader) Download(partFilePath string, backCall func(fileTotalSize int, fileName string, Index int)) error
Run 开始下载任务
func (*Downloader) SetCoroutineNum ¶
func (d *Downloader) SetCoroutineNum(partCoroutineNum int)
func (*Downloader) SetPartSize ¶
func (d *Downloader) SetPartSize(partSize int)
func (*Downloader) SetTotalPart ¶
func (d *Downloader) SetTotalPart(totalPart int)
type Part ¶
type Part struct { Index int //文件分片的序号 From int //开始byte To int //解决byte Data []byte //http下载得到的文件内容 FilePath string //下载到本地的分片文件路径 }
filePart 文件分片
Click to show internal directories.
Click to hide internal directories.