[Poly > Mkdirp] Simplify, remove logs
This commit is contained in:
parent
1d78f47fdc
commit
ebe7e38ec8
1 changed files with 4 additions and 9 deletions
|
@ -1,21 +1,16 @@
|
||||||
// Minimal wrapper mimicking mkdirp package
|
// Minimal wrapper mimicking mkdirp package
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const async = (path, callback) => { // async
|
const mk = (path, callback) => { // async
|
||||||
log('Mkdirp', 'Async:', path);
|
fs.mkdir(path, { recursive: true }, () => { // Already exists, ignore
|
||||||
|
|
||||||
fs.mkdir(path, { recursive: true }, () => { // Ignore errors (already exists)
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const sync = (path) => { // sync
|
mk.sync = (path) => { // sync
|
||||||
log('Mkdirp', 'Sync:', path);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(path, { recursive: true });
|
fs.mkdirSync(path, { recursive: true });
|
||||||
} catch (e) { } // Already exists, ignore
|
} catch (e) { } // Already exists, ignore
|
||||||
};
|
};
|
||||||
|
|
||||||
async.sync = sync;
|
module.exports = mk;
|
||||||
module.exports = async;
|
|
Loading…
Reference in a new issue