enhanced: download progress
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"MacFastLookup/service"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -37,7 +38,8 @@ func (a *App) StartDownload() {
|
||||
os.Mkdir(path, 0755)
|
||||
}
|
||||
|
||||
service.DownloadFile("https://tools.taurusxin.com/macfastlookup/mac_vendors.sqlite3", dbFilePath, true, func(progress, total int64) {
|
||||
runtime.EventsEmit(a.ctx, "download-progress", float32(progress / total))
|
||||
service.EnhancedDownload("https://tools.taurusxin.com/macfastlookup/mac_vendors.sqlite3", dbFilePath, true, func(downloaded, total, rate int64, packageName string) {
|
||||
fmt.Printf("\rDownloading[%s][ %d%% ][%d/%d]", packageName, rate, downloaded, total)
|
||||
runtime.EventsEmit(a.ctx, "download-progress", rate)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user