mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 01:40:13 +01:00
Attachment size, changed calculation to npm filesize (Version Info)
This commit is contained in:
parent
464bc2f87b
commit
20c2679dc8
2 changed files with 18 additions and 21 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { TAPi18n } from '/imports/i18n';
|
||||
const filesize = require('filesize');
|
||||
|
||||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
|
|
@ -39,12 +40,8 @@ BlazeComponent.extendComponent({
|
|||
return parseFloat(number).toFixed(2);
|
||||
},
|
||||
|
||||
bytesToSize(bytes) {
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (bytes === 0) {
|
||||
return '0 Byte';
|
||||
}
|
||||
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
|
||||
return `${Math.round(bytes / Math.pow(1024, i), 2)} ${sizes[i]}`;
|
||||
fileSize(size) {
|
||||
const ret = filesize(size);
|
||||
return ret;
|
||||
},
|
||||
}).register('statistics');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue