Closed
Description
- Version: 10.16.0, 11.14.0, 12.6.0
- Platform: Windows 10
- Subsystem: fs
If the name of the dir to be created is invalid, fs.mkdir never calls back and fs.mkdirSync blocks:
const fs = require('fs')
console.log("1")
fs.mkdir('invalid1:', {recursive: true}, (err) => {
console.log("is not called")
if (err) throw err
})
console.log("2")
fs.mkdirSync('invalid2:', {recursive: true})
console.log("is not reached")
BTW, the error message that is reported with {recursive: false} appears a bit strange:
Error: ENOENT: no such file or directory, mkdir 'invalid2:'
Wouldn't it be more convenient to use EPERM, EACCES or ENOTDIR?