This commit is contained in:
afkarxyz
2025-11-22 17:59:48 +07:00
parent 8a2dbe4e32
commit d90221b835
11 changed files with 211 additions and 15 deletions
+6 -3
View File
@@ -184,13 +184,16 @@ func (q *QobuzDownloader) DownloadFile(url, filepath string) error {
}
defer out.Close()
fmt.Println("Writing file content...")
written, err := io.Copy(out, resp.Body)
fmt.Println("Downloading...")
// Use progress writer to track download
pw := NewProgressWriter(out)
_, err = io.Copy(pw, resp.Body)
if err != nil {
return fmt.Errorf("failed to write file: %w", err)
}
fmt.Printf("✓ Downloaded %d bytes\n", written)
// Print final size
fmt.Printf("\rDownloaded: %.2f MB (Complete)\n", float64(pw.GetTotal())/(1024*1024))
return nil
}