We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b906f86 commit 44042f3Copy full SHA for 44042f3
src/lib/report-size.ts
@@ -2,7 +2,7 @@ import colors from 'picocolors'
2
import type { Logger } from '../log'
3
4
const prettyBytes = (bytes: number) => {
5
- if (bytes === 0) return '0 B'
+ if (bytes < 1024) return `${bytes} B`
6
const unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
7
const exp = Math.floor(Math.log(bytes) / Math.log(1024))
8
return `${(bytes / 1024 ** exp).toFixed(2)} ${unit[exp]}`
0 commit comments