feat: support RESTful api (#33)

This commit is contained in:
monkeyWie authored and GitHub committed 2022-09-09 18:31:57 +08:00
1 parent e292926697
commit c6aa83194f
22 files changed
+603 -125

No files matched your search

+3 -3
View File
@@ -15,7 +15,7 @@ func main() {
args := parse()
var wg sync.WaitGroup
err := download.Boot().
_, err := download.Boot().
URL(args.url).
Listener(func(event *download.Event) {
if event.Key == download.EventKeyProgress {
@@ -55,10 +55,10 @@ var (
)
func printProgress(task *download.Task, title string) {
rate := float64(task.Progress.Downloaded) / float64(task.Res.Length)
rate := float64(task.Progress.Downloaded) / float64(task.Res.Size)
completeWidth := int(progressWidth * rate)
speed := util.ByteFmt(task.Progress.Speed)
totalSize := util.ByteFmt(task.Res.Length)
totalSize := util.ByteFmt(task.Res.Size)
sb.WriteString(fmt.Sprintf("\r%s [", title))
for i := 0; i < progressWidth; i++ {
if i < completeWidth {