Details
Before creating a directory under a specific directory like mkdir, I would like to check the permissions and see if the directory can be created.
I think the method of receiving an error in the mkdir callback is correct originally, but that method cannot be used because mkdir is executed in the processing of the external library.
After reviewing the documentation, I think the correct way is to use "opendir" to receive the callback.
Is that the right way?
Also, if you use the fs module "opendir", "access" for a directory that you do not have write permission for, the result will be different.
I'd like to know why the results are different, do you understand?
- access (params : fs.constants.W_OK)
- opendir
- Error callback is returned
OS: Windows 10
Directory: Program Files
Node.js version
14.15.3
Example code
No response
Operating system
Windows 10
Scope
other
Module and version
Not applicable.
Details
Before creating a directory under a specific directory like mkdir, I would like to check the permissions and see if the directory can be created.
I think the method of receiving an error in the mkdir callback is correct originally, but that method cannot be used because mkdir is executed in the processing of the external library.
After reviewing the documentation, I think the correct way is to use "opendir" to receive the callback.
Is that the right way?
Also, if you use the fs module "opendir", "access" for a directory that you do not have write permission for, the result will be different.
I'd like to know why the results are different, do you understand?
OS: Windows 10
Directory: Program Files
Node.js version
14.15.3
Example code
No response
Operating system
Windows 10
Scope
other
Module and version
Not applicable.