diff --git a/lib/common.js b/lib/common.js old mode 100644 new mode 100755 index fb230d8..7ffc4d7 --- a/lib/common.js +++ b/lib/common.js @@ -10,6 +10,7 @@ const async = require('async'); const nodemailer = require('nodemailer'); const sanitizeHtml = require('sanitize-html'); const escape = require('html-entities').AllHtmlEntities; +const mkdirp = require('mkdirp'); let ObjectId = require('mongodb').ObjectID; const restrictedRoutes = [ @@ -177,7 +178,12 @@ exports.checkDirectorySync = (directory) => { try{ fs.statSync(directory); }catch(e){ + try{ fs.mkdirSync(directory); + } + catch(err){ + mkdirp.sync(directory);//error : directory & sub directories to be newly created + } } };