From 891adcd4a935f9d1c45aa20dc8f046f09d772210 Mon Sep 17 00:00:00 2001 From: tgpethan Date: Thu, 20 Feb 2020 23:54:31 +0000 Subject: [PATCH] Make the api return mb and gb values as well as a string for the space used --- EUS.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/EUS.js b/EUS.js index d58c451..83c0e37 100644 --- a/EUS.js +++ b/EUS.js @@ -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)); }); } -- 2.47.0