Skip to content

Instantly share code, notes, and snippets.

@yesvods
Created April 19, 2016 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yesvods/f4374f3652011ef7d73d9e4d779d22f3 to your computer and use it in GitHub Desktop.
Save yesvods/f4374f3652011ef7d73d9e4d779d22f3 to your computer and use it in GitHub Desktop.
check if directory exist, if not, create one.
function checkDirectorySync(directory) {
try {
fs.statSync(directory);
} catch(e) {
fs.mkdirSync(directory);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment