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 +
I have found and npm module that works like a charm for this. It's simply do a recursively mkdir when needed, like a "mkdir -p ".
https://www.npmjs.com/package/mkdirp