Skip to content

Commit

Permalink
fix: formatSize number less than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
xsteadybcgo committed Sep 3, 2021
1 parent cc95130 commit 26be0c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const formatTime = (val: string) => {
}

const formatSize = (bytes: number) => {
if (bytes === 0) return '0 B'
if (bytes < 1) return bytes + ' B'
let k = 1024,
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k))
Expand Down

0 comments on commit 26be0c5

Please sign in to comment.