mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Lots of bugfixes, improvements: Dinamyc QA, file uploading refactoring, file managing logging improvements ...
This commit is contained in:
22
utils.js
Normal file → Executable file
22
utils.js
Normal file → Executable file
@@ -6,7 +6,8 @@ module.exports = {
|
||||
Beep: Beep,
|
||||
WriteBackup: WriteBackup,
|
||||
FileExists: FileExists,
|
||||
CreatePath: CreatePath
|
||||
CreatePath: CreatePath,
|
||||
GetAllFilesFromFolder: GetAllFilesFromFolder
|
||||
};
|
||||
|
||||
var fs = require('fs');
|
||||
@@ -86,3 +87,22 @@ function WriteBackup() {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
function GetAllFilesFromFolder(dir) {
|
||||
|
||||
var results = [];
|
||||
|
||||
fs.readdirSync(dir).forEach(function(file) {
|
||||
|
||||
file = dir + '/' + file;
|
||||
var stat = fs.statSync(file);
|
||||
|
||||
if (stat && stat.isDirectory()) {
|
||||
results = results.concat(_getAllFilesFromFolder(file));
|
||||
} else results.push(file);
|
||||
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user