bare-fs 4.4.8 → 4.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -742,7 +742,9 @@ async function mkdir(filepath, opts, cb) {
|
|
|
742
742
|
try {
|
|
743
743
|
await mkdir(filepath, { mode })
|
|
744
744
|
} catch (err) {
|
|
745
|
-
if (err.code
|
|
745
|
+
if (err.code !== 'ENOENT') {
|
|
746
|
+
if (!(await stat(filepath)).isDirectory()) throw err
|
|
747
|
+
} else {
|
|
746
748
|
while (filepath.endsWith(path.sep)) filepath = filepath.slice(0, -1)
|
|
747
749
|
const i = filepath.lastIndexOf(path.sep)
|
|
748
750
|
if (i <= 0) throw err
|
|
@@ -793,7 +795,9 @@ function mkdirSync(filepath, opts) {
|
|
|
793
795
|
try {
|
|
794
796
|
mkdirSync(filepath, { mode })
|
|
795
797
|
} catch (err) {
|
|
796
|
-
if (err.code
|
|
798
|
+
if (err.code !== 'ENOENT') {
|
|
799
|
+
if (!statSync(filepath).isDirectory()) throw err
|
|
800
|
+
} else {
|
|
797
801
|
while (filepath.endsWith(path.sep)) filepath = filepath.slice(0, -1)
|
|
798
802
|
const i = filepath.lastIndexOf(path.sep)
|
|
799
803
|
if (i <= 0) throw err
|