Skip to content

Commit 36306bf

Browse files
authored
fix: use fractions instead of percents for progress (#47)
We should be passing fractions back to the caller, not whole percentages
1 parent 04ffc5e commit 36306bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ export default class DownloadQueue {
732732
if (!this.active) {
733733
task.pause();
734734
}
735-
const percent = (bytesDownloaded / bytesTotal) * 100;
736-
this.handlers?.onProgress?.(url, percent, bytesDownloaded, bytesTotal);
735+
const fraction = bytesDownloaded / bytesTotal;
736+
this.handlers?.onProgress?.(url, fraction, bytesDownloaded, bytesTotal);
737737
})
738738
// eslint-disable-next-line @typescript-eslint/no-misused-promises
739739
.done(async () => await this.doDone(url, task))

0 commit comments

Comments
 (0)