- Version: v10.15.0
- Platform: win10
- Subsystem: x64 win32
create a new file and set the file name 'test'
the index.js is same level
// index.js
const fs = require('fs')
fs.mkdir('./test', {
recursive: true
}, (err) => {
console.log(err) // [Error: EEXIST: file already exists]
})
this will trigger the error
const fs = require('fs')
fs.mkdir('./test/a', {
recursive: true
}, (err) => {
console.log(err)
})
this will not trigger the error and the process does not exit
if test is a directory is no problem, but if test is a file and recursive is true, the process does not exit and keep waiting and not trigger error
create a new file and set the file name 'test'
the index.js is same level
this will trigger the error
this will not trigger the error and the process does not exit
if test is a directory is no problem, but if test is a file and recursive is true, the process does not exit and keep waiting and not trigger error