Updated code to use mkdirp. Directory is not created unless it doesn't exist.