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 +
Just in case any one interested in the one line version. :)
//or in typescript: import * as fs from 'fs'; const fs = require('fs'); !fs.existsSync(dir) && fs.mkdirSync(dir);