feat: 命令行工具

This commit is contained in:
liwei committed 2021-03-23 19:03:46 +08:00
1 parent f150ec23c4
commit 046729bfaa
10 files changed
+195 -31

No files matched your search

+12
View File
@@ -199,6 +199,18 @@ func (f *Fetcher) Continue() (err error) {
return
}
func (f *Fetcher) Progress() base.Progress {
p := make(base.Progress, 0)
if len(f.chunks) > 0 {
total := int64(0)
for _, chunk := range f.chunks {
total += chunk.Downloaded
}
p = append(p, total)
}
return p
}
func (f *Fetcher) filename() string {
// 创建文件
var filename = f.opts.Name