OpenAsar/polyfills/mkdirp.js

14 lines
329 B
JavaScript
Raw Normal View History

// Minimal wrapper mimicking mkdirp package
const fs = require('fs');
2022-01-25 22:48:40 +00:00
const mk = (path, callback) => { // async
2022-01-29 10:12:24 +00:00
fs.mkdir(path, { recursive: true }, () => callback()); // Never error
};
2022-01-25 22:48:40 +00:00
mk.sync = (path) => { // sync
try {
fs.mkdirSync(path, { recursive: true });
2022-01-29 10:12:24 +00:00
} catch (e) { } // Never error
};
2022-01-25 22:48:40 +00:00
module.exports = mk;