Display filesize in base 2 format (KiB instead of KB)

This commit is contained in:
Kloon ImKloon 2023-10-06 19:57:59 +02:00
parent 6332514ccc
commit 49e3b6231e
No known key found for this signature in database
GPG Key ID: CCF1C86A995C5B6A
3 changed files with 6 additions and 4 deletions

View File

@ -105,7 +105,9 @@ export default {
...mapActions(useFileStore, ["removeSelected"]),
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
humanSize: function () {
return this.type == "invalid_link" ? "invalid link" : filesize(this.size);
return this.type == "invalid_link"
? "invalid link"
: filesize(this.size, { base: 2 });
},
humanTime: function () {
if (this.readOnly == undefined && this.user.dateFormat) {

View File

@ -99,7 +99,7 @@ export default {
]),
humanSize: function () {
if (this.selectedCount === 0 || !this.isListing) {
return filesize(this.req.size);
return filesize(this.req.size, { base: 2 });
}
let sum = 0;
@ -108,7 +108,7 @@ export default {
sum += this.req.items[selected].size;
}
return filesize(sum);
return filesize(sum, { base: 2 });
},
humanTime: function () {
if (this.selectedCount === 0) {

View File

@ -241,7 +241,7 @@ const humanSize = computed(() => {
if (req.value) {
return req.value.isDir
? req.value.items.length
: filesize(req.value.size ?? 0);
: filesize(req.value.size ?? 0, { base: 2 });
} else {
return "";
}