node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »

safe-mkdir

safe-mkdir

A version of fs.mkdir and fs.mkdirSync that doesn't raise EEXIST.

Usage

$ npm install safe-mkdir
(...)
$ node
> var safeMkdir = require('safe-mkdir').mkdir
undefined
> safeMkdir('crazy-folder', function (err) { // err is never EEXIST 
  // handle as you wish 
});
undefined