|
|
@ -1,6 +1,8 @@
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const path = require('path');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const { s3enabled } = require('./config.json');
|
|
|
|
const { formatBytes } = require('./utils');
|
|
|
|
const { formatBytes } = require('./utils');
|
|
|
|
|
|
|
|
const { bucketSize } = require('./storage');
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = () => {
|
|
|
|
module.exports = () => {
|
|
|
|
let data = fs.readJsonSync(path.join(__dirname, 'data.json'));
|
|
|
|
let data = fs.readJsonSync(path.join(__dirname, 'data.json'));
|
|
|
@ -21,17 +23,23 @@ module.exports = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
console.log('---- Usage metrics ----\n');
|
|
|
|
// Get AWS size
|
|
|
|
console.log(`Users: ${Object.keys(users).length}`);
|
|
|
|
bucketSize()
|
|
|
|
console.log(`Files: ${Object.keys(data).length}`);
|
|
|
|
.then((s3size) => {
|
|
|
|
console.log('');
|
|
|
|
console.log('---- Usage metrics ----\n');
|
|
|
|
console.log(`Total size: ${formatBytes(totalSize)}`);
|
|
|
|
console.log(`Users: ${Object.keys(users).length}`);
|
|
|
|
console.log(`Untracked size: ${formatBytes(oldSize)}`);
|
|
|
|
console.log(`Files: ${Object.keys(data).length}`);
|
|
|
|
console.log('');
|
|
|
|
console.log(`S3 size: ${s3enabled ? s3size : '--'}`);
|
|
|
|
|
|
|
|
console.log('');
|
|
|
|
|
|
|
|
console.log(`Total size: ${formatBytes(totalSize)}`);
|
|
|
|
|
|
|
|
console.log(`Untracked size: ${formatBytes(oldSize)}`);
|
|
|
|
|
|
|
|
console.log('');
|
|
|
|
|
|
|
|
|
|
|
|
Object.values(users).forEach(({ username, count, size }) => {
|
|
|
|
Object.values(users).forEach(({ username, count, size }) => {
|
|
|
|
console.log(`- ${username}: ${formatBytes(size)} (${count} files)`);
|
|
|
|
console.log(`- ${username}: ${formatBytes(size)} (${count} files)`);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(console.error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (require.main === module) module.exports();
|
|
|
|
if (require.main === module) module.exports();
|
|
|
|