Improved uploader

This commit is contained in:
2018-04-17 13:01:51 +02:00
parent 8cb44131cf
commit d9ff1513b8
3 changed files with 24 additions and 17 deletions

View File

@ -0,0 +1,15 @@
export function bytesHumanReadable(fileSize: number): string {
let unit = "bytes"
if(fileSize >= 1024) {
fileSize /= 1024
unit = "KB"
if(fileSize >= 1024) {
fileSize /= 1024
unit = "MB"
}
}
return `${fileSize.toFixed(0)} ${unit}`
}