2
0
Files
bot/apps/builder/components/dashboard/WorkspaceSettingsModal/BillingContent/UsageContent/helpers.ts
2022-09-27 08:30:42 +02:00

8 lines
233 B
TypeScript

export const storageToReadable = (bytes: number) => {
if (bytes == 0) {
return '0'
}
const e = Math.floor(Math.log(bytes) / Math.log(1024))
return (bytes / Math.pow(1024, e)).toFixed(2) + ' ' + ' KMGTP'.charAt(e) + 'B'
}