Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Processer int = runtime.NumCPU()
线程数
View Source
var Thread int = 1
Functions ¶
Types ¶
type DownLoader ¶
type DownLoader struct { Url string `json:"-"` FileName string `json:"filename"` Dir string `json:"-"` // 下载文件存放的目录 Length int64 `json:"-"` // 目标的content-length WG *sync.WaitGroup `json:"-"` Threads int `json:"threads"` Meta string `json:"-"` // 元数据文件,全路径 Trips []*Trip `json:"trips"` // 分片的列表 }
func New ¶
func New(url string, dir ...string) *DownLoader
创建一个下载器,用于下载.
<url>: 目标的URL;
[dir]: 存放的目录.
func (*DownLoader) AcceptRages ¶
func (d *DownLoader) AcceptRages() (accept bool, err error)
是否支持分段断点续传, 如果支持断点则获取长度
func (*DownLoader) Down ¶
func (d *DownLoader) Down() error
func (*DownLoader) GetPath ¶
func (d *DownLoader) GetPath() string
func (*DownLoader) SetDir ¶
func (d *DownLoader) SetDir(dir string)
func (*DownLoader) SetThread ¶
func (d *DownLoader) SetThread(t int)
Click to show internal directories.
Click to hide internal directories.