MCPcopy
hub / github.com/webpack/webpack / mkdirpSync

Function mkdirpSync

lib/util/fs.js:644–666  ·  view source on GitHub ↗
(fs, p)

Source from the content-addressed store, hash-verified

642 * @returns {void}
643 */
644const mkdirpSync = (fs, p) => {
645 try {
646 fs.mkdirSync(p);
647 } catch (err) {
648 if (err) {
649 if (/** @type {NodeJS.ErrnoException} */ (err).code === "ENOENT") {
650 const dir = dirname(fs, p);
651 if (dir === p) {
652 throw err;
653 }
654 mkdirpSync(fs, dir);
655 fs.mkdirSync(p);
656 return;
657 } else if (
658 /** @type {NodeJS.ErrnoException} */ (err).code === "EEXIST" ||
659 /** @type {NodeJS.ErrnoException} */ (err).code === "EISDIR"
660 ) {
661 return;
662 }
663 throw err;
664 }
665 }
666};
667
668/**
669 * Processes the provided f.

Callers 1

createTraceFunction · 0.85

Calls 1

dirnameFunction · 0.85

Tested by

no test coverage detected