1.1.0 • Published 10 years ago
fs-force-mkdir-sync v1.1.0
fs-force-mkdir
Requirements
- Node >= 6.0.0
Usage
var mkdirSync = require('fs-force-mkdir-sync');
try {
let info = mkdirSync('./a/b/c');
console.log('Succeed', info);
} catch (error) {
console.error('Failed', error);
}The code above would check for existence of './a', './a/b' and './a/b/c',
- If one is a directory,
mkdirskip this directory and check the next - If one doesn't exist,
mkdirwould creates it as a empty directory - If one is a file,
mkdirwould deletes that file and creates a directory with the same name