Make the api return mb and gb values as well as a string for the space used

This commit is contained in:
tgpethan 2020-02-20 23:54:31 +00:00
parent a72b77b32b
commit 891adcd4a9

10
EUS.js
View file

@ -107,11 +107,15 @@ module.exports = {
});
}
if (spaceaa == 1) {
jsonaa["used"] = "";
jsonaa["space"] = {};
getSize(__dirname + BASE_PATH + "/i", (err, size) => {
if (err) throw err;
const sizeOfFolder = (size / 1024 / 1024 / 1024).toFixed(2);
jsonaa["used"] = `${sizeOfFolder} GB`;
let sizeOfFolder = (size / 1024 / 1024);
jsonaa["space"]["mb"] = sizeOfFolder;
sizeOfFolder = (size / 1024 / 1024 / 1024);
jsonaa["space"]["gb"] = sizeOfFolder;
sizeOfFolder = (size / 1024 / 1024 / 1024).toFixed(2);
jsonaa["space"]["string"] = `${sizeOfFolder} GB`;
return res.end(JSON.stringify(jsonaa));
});
}