From ec9a042017d53b58db8327012e172e7117aa4fa1 Mon Sep 17 00:00:00 2001 From: Philip Su <39933441+fivecar@users.noreply.github.com> Date: Mon, 7 Apr 2025 23:27:49 -0700 Subject: [PATCH] fix: use fractions instead of percents for progress We should be passing fractions back to the caller, not whole percentages --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7eaf9b9..282e4ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -732,8 +732,8 @@ export default class DownloadQueue { if (!this.active) { task.pause(); } - const percent = (bytesDownloaded / bytesTotal) * 100; - this.handlers?.onProgress?.(url, percent, bytesDownloaded, bytesTotal); + const fraction = bytesDownloaded / bytesTotal; + this.handlers?.onProgress?.(url, fraction, bytesDownloaded, bytesTotal); }) // eslint-disable-next-line @typescript-eslint/no-misused-promises .done(async () => await this.doDone(url, task))