[Poly > Mkdirp] Cleanup a bit

This commit is contained in:
Ducko 2022-01-29 10:12:24 +00:00
parent 5949633d03
commit d0e8c3f35d

View file

@ -2,15 +2,13 @@
const fs = require('fs');
const mk = (path, callback) => { // async
fs.mkdir(path, { recursive: true }, () => { // Already exists, ignore
callback();
});
fs.mkdir(path, { recursive: true }, () => callback()); // Never error
};
mk.sync = (path) => { // sync
try {
fs.mkdirSync(path, { recursive: true });
} catch (e) { } // Already exists, ignore
} catch (e) { } // Never error
};
module.exports = mk;