Is this the right way to create a directory if it doesn\'t exist. It should have full permission for the script and readable by others.
var dir = __dirname +
var dir = 'path/to/dir'; try { fs.mkdirSync(dir); } catch(e) { if (e.code != 'EEXIST') throw e; }