[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 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;
|
Loading…
Reference in a new issue