Documentation
¶
Index ¶
- Constants
- type DownloadManager
- func (dm *DownloadManager) Downloads() []*Downloader
- func (dm *DownloadManager) EnableAutoRecycle()
- func (dm *DownloadManager) FinishedDownloads() []*Downloader
- func (dm *DownloadManager) Recycle()
- func (dm *DownloadManager) Remove(url string) bool
- func (dm *DownloadManager) Retrive(url string) (dl *Downloader, err error)
- type Downloader
- type ProxyWriter
Constants ¶
View Source
const ( STATUS_DOWNLOADING = "downloading" STATUS_SUCCESS = "success" STATUS_FAILURE = "failure" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadManager ¶
type DownloadManager struct {
// contains filtered or unexported fields
}
DownloadManager manager all Downloaders
func NewDownloadManager ¶
func NewDownloadManager() *DownloadManager
func (*DownloadManager) Downloads ¶
func (dm *DownloadManager) Downloads() []*Downloader
func (*DownloadManager) EnableAutoRecycle ¶
func (dm *DownloadManager) EnableAutoRecycle()
func (*DownloadManager) FinishedDownloads ¶
func (dm *DownloadManager) FinishedDownloads() []*Downloader
FinishedDownloads Ordered by FinishedAt
func (*DownloadManager) Remove ¶
func (dm *DownloadManager) Remove(url string) bool
Remove download from manager
func (*DownloadManager) Retrive ¶
func (dm *DownloadManager) Retrive(url string) (dl *Downloader, err error)
Retrive url as local file
type Downloader ¶
type Downloader struct { Filename string `json:"filename"` ContentLength int64 `json:"contentLength"` Status string `json:"status"` Description string `json:"description"` URL string `json:"url"` CreatedAt time.Time `json:"createdAt"` FinishedAt time.Time `json:"finishedAt"` AccessedAt time.Time `json:"accessedAt"` // TODO(ssx): need to use some times // contains filtered or unexported fields }
func (*Downloader) Finished ¶
func (dl *Downloader) Finished() bool
func (*Downloader) HumanSpeed ¶
func (dl *Downloader) HumanSpeed() string
func (*Downloader) Wait ¶
func (dl *Downloader) Wait()
func (*Downloader) Written ¶
func (dl *Downloader) Written() int64
type ProxyWriter ¶
ProxyWriter record download bytes
func NewProxyWriter ¶
func NewProxyWriter(wr io.Writer) *ProxyWriter
func (*ProxyWriter) HumanSpeed ¶
func (p *ProxyWriter) HumanSpeed() string
func (*ProxyWriter) Written ¶
func (p *ProxyWriter) Written() int
Click to show internal directories.
Click to hide internal directories.