feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -9,7 +9,7 @@
* @param {number} size the size in bytes
* @returns {string} the formatted size
*/
exports.formatSize = size => {
module.exports.formatSize = size => {
if (typeof size !== "number" || Number.isNaN(size) === true) {
return "unknown size";
}
@@ -21,7 +21,5 @@ exports.formatSize = size => {
const abbreviations = ["bytes", "KiB", "MiB", "GiB"];
const index = Math.floor(Math.log(size) / Math.log(1024));
return `${+(size / Math.pow(1024, index)).toPrecision(3)} ${
abbreviations[index]
}`;
return `${Number((size / 1024 ** index).toPrecision(3))} ${abbreviations[index]}`;
};