Skip to content

Commit

Permalink
fix: use file size as download progress fallback calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed May 14, 2024
1 parent f592a28 commit 8d21a84
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mixins/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,16 @@ export default class FilesMixin extends Vue {
...options,
signal: abortController.signal,
onDownloadProgress: (event: AxiosProgressEvent) => {
const progress = event.progress ?? (
size > 0
? event.loaded / size
: 0
)

const payload: any = {
filepath,
loaded: event.loaded,
percent: event.progress ? Math.round(event.progress * 100) : 0,
percent: Math.round(progress * 100),
speed: event.rate ?? 0
}

Expand Down

0 comments on commit 8d21a84

Please sign in to comment.