- versione 1.2.50

This commit is contained in:
Surya Paolo
2025-05-23 19:02:51 +02:00
parent 0e5d28d199
commit 9efd193124
5 changed files with 103 additions and 14 deletions

View File

@@ -6124,7 +6124,7 @@ module.exports = {
}
return filename;
},
isDateValid(mydate) {
try {
return (
@@ -6135,6 +6135,22 @@ module.exports = {
}
},
async getSizeFile(filename) {
try {
if (await this.isFileExistsAsync(filename)) {
const stats = fs.statSync ? fs.statSync(filename) : null;
const fileSizeInBytes = stats.size;
const fileSizeInMB = fileSizeInBytes / (1024 * 1024);
return fileSizeInMB.toFixed(2); // Returns size in MB with 2 decimal places
} else {
return 0;
}
} catch (e) {
console.error('Error getting file size:', e);
return '0.00';
}
},
aggiungiSuffissoAlNomeFile(filePath, suffisso) {
const dir = path.dirname(filePath);
const estensione = path.extname(filePath);