Documentation ¶
Overview ¶
* * * parallel download files * downloading with progress info and retry until completed * zssty2010@gmail.com
Index ¶
Constants ¶
View Source
const ( Processing = iota Completed Failed )
Variables ¶
This section is empty.
Functions ¶
func NewPrinter ¶
func NewPrinter(stat *statistics) func(TaskProgress)
golang not support default value. so we can use closures to do like this
Types ¶
type MultitaskDL ¶
type MultitaskDL struct { ThreadNum int // contains filtered or unexported fields }
func NewMultitaskDL ¶
func NewMultitaskDL(n int) MultitaskDL
func (*MultitaskDL) Do ¶
func (dl *MultitaskDL) Do(res Resource, taskTrace chan TaskProgress) error
func (*MultitaskDL) ShutdownAndWait ¶
func (dl *MultitaskDL) ShutdownAndWait()
func (*MultitaskDL) StartDownload ¶
func (dl *MultitaskDL) StartDownload(resources []Resource)
main method start to download files
func (*MultitaskDL) StartSyncDownload ¶
func (dl *MultitaskDL) StartSyncDownload(resourceChan chan Resource)
type TaskProgress ¶
type TaskProgress struct {
// contains filtered or unexported fields
}
inner struct to trace download progress
func (*TaskProgress) Failed ¶
func (progress *TaskProgress) Failed(err error) error
func (*TaskProgress) Finish ¶
func (progress *TaskProgress) Finish() error
Click to show internal directories.
Click to hide internal directories.