adds width and height to uploads that match proper mime type, continues build to FileDetails

This commit is contained in:
James
2020-06-24 18:55:03 -04:00
parent b5f8178de2
commit a27f804b9c
15 changed files with 191 additions and 31 deletions

View File

@@ -0,0 +1,13 @@
function formatBytes(bytes, decimals = 0) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`;
}
module.exports = formatBytes;