[Poly > Mkdirp] Cleanup a bit
This commit is contained in:
parent
5949633d03
commit
d0e8c3f35d
1 changed files with 2 additions and 4 deletions
|
@ -2,15 +2,13 @@
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const mk = (path, callback) => { // async
|
const mk = (path, callback) => { // async
|
||||||
fs.mkdir(path, { recursive: true }, () => { // Already exists, ignore
|
fs.mkdir(path, { recursive: true }, () => callback()); // Never error
|
||||||
callback();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mk.sync = (path) => { // sync
|
mk.sync = (path) => { // sync
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(path, { recursive: true });
|
fs.mkdirSync(path, { recursive: true });
|
||||||
} catch (e) { } // Already exists, ignore
|
} catch (e) { } // Never error
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = mk;
|
module.exports = mk;
|
Loading…
Add table
Add a link
Reference in a new issue