Answers for "if(err.code == 'EEXIST') to check if directory exists"

6

nodejs make directory

var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){
    fs.mkdirSync(dir);
}

// or if complains about existence and nesting doesn't matter:

var shell = require('shelljs');
shell.mkdir('-p', 'root/parent/tmp');
Posted by: Guest on March-30-2020

Code answers related to "if(err.code == 'EEXIST') to check if directory exists"

Code answers related to "Javascript"

Browse Popular Code Answers by Language