Skip to content

Instantly share code, notes, and snippets.

@senthilmpro
Created May 6, 2018 20:26
Show Gist options
  • Save senthilmpro/35667369e81b624f4243caea9bcdd17f to your computer and use it in GitHub Desktop.
Save senthilmpro/35667369e81b624f4243caea9bcdd17f to your computer and use it in GitHub Desktop.
Create folder into disk. ( check for existing folder)
const fs = require('fs');
// CREATE FOLDER
function createFolder(folderName) {
if (!fs.existsSync(folderName)) {
fs.mkdirSync(folderName, 0766, function (err) {
console.log(err);
});
} else {
console.log("ERROR >> cannot create folder. Folder already exists");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment