Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/primefaces/primeng
Browse files Browse the repository at this point in the history
  • Loading branch information
cetincakiroglu committed Aug 10, 2023
2 parents a52eb68 + 043660a commit 27b2abb
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/app/components/fileupload/fileupload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,15 +825,18 @@ export class FileUpload implements AfterViewInit, AfterContentInit, OnInit, OnDe
}

formatSize(bytes: number) {
if (bytes == 0) {
const k = 1024;
const dm = 3;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

if (bytes === 0) {
return '0 B';
}
let k = 1000,
dm = 3,
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));

return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
const i = Math.floor(Math.log(bytes) / Math.log(k));
const formattedSize = (bytes / Math.pow(k, i)).toFixed(dm);

return `${formattedSize} ${sizes[i]}`;
}

onBasicUploaderClick() {
Expand Down

1 comment on commit 27b2abb

@vercel
Copy link

@vercel vercel bot commented on 27b2abb Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.