Skip to content

Commit 44042f3

Browse files
committed
fix: remove decimal places when displaying only bytes
1 parent b906f86 commit 44042f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/report-size.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import colors from 'picocolors'
22
import type { Logger } from '../log'
33

44
const prettyBytes = (bytes: number) => {
5-
if (bytes === 0) return '0 B'
5+
if (bytes < 1024) return `${bytes} B`
66
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
77
const exp = Math.floor(Math.log(bytes) / Math.log(1024))
88
return `${(bytes / 1024 ** exp).toFixed(2)} ${unit[exp]}`

0 commit comments

Comments
 (0)