fsPromises.mkdir(path[, options])


path 是已存在的目录时,调用 fsPromises.mkdir() 仅在 recursive 为 false 时才导致拒绝。

Asynchronously creates a directory then resolves the Promise with either no arguments, or the first directory path created if recursive is true.

The optional options argument can be an integer specifying mode (permission and sticky bits), or an object with a mode property and a recursive property indicating whether parent directories should be created. Calling fsPromises.mkdir() when path is a directory that exists results in a rejection only when recursive is false.