What is the problem this feature will solve?
This is a little different from a feature request, but since there has been no progress on the issue I have set up in nodejs/help, I will ask here, and if the feature does not exist, I will make a feature request.
The following is the issue created in nodejs/help.
nodejs/help#3871
We wanted to check the permissions of a directory and were trying to use fs.accessSync.
We have confirmed that the results are correct on macOS, but not on Windows OS.
I have confirmed that using fs.openSync produces the correct results for Windows OS, but why do these differences occur?
Also, there is no mention in the node.js documentation that the behavior changes for each OS, but is using fs.openSync the correct way to check directory permissions on Windows OS?
- Result of
fs.accessSync check
Mac OS
| Parameter |
Permission |
result |
| constants.R_OK |
Readable |
Success |
| constants.R_OK |
Writable |
Failure |
| constants.R_OK |
Executable |
Failure |
| constants.W_OK |
Readable |
Failure |
| constants.W_OK |
Writable |
Success |
| constants.W_OK |
Executable |
Failure |
| constants.X_OK |
Readable |
Failure |
| constants.X_OK |
Writable |
Failure |
| constants.X_OK |
Executable |
Success |
Windows OS
| Parameter |
Permission |
result |
| constants.R_OK |
Read |
Success |
| constants.R_OK |
Write |
Success |
| constants.R_OK |
List folder contens |
Success |
| constants.W_OK |
Read |
Success |
| constants.W_OK |
Write |
Success |
| constants.W_OK |
List folder contens |
Success |
| constants.X_OK |
Read |
Success |
| constants.X_OK |
Write |
Success |
| constants.X_OK |
List folder contens |
Success |
What is the feature you are proposing to solve the problem?
A method that does not return different results on macOS and Windows OS.
Or, we think it would be easier to add an explanation on the documentation to show that the results are different depending on the OS.
What alternatives have you considered?
No response
What is the problem this feature will solve?
This is a little different from a feature request, but since there has been no progress on the issue I have set up in
nodejs/help, I will ask here, and if the feature does not exist, I will make a feature request.The following is the issue created in
nodejs/help.nodejs/help#3871
We wanted to check the permissions of a directory and were trying to use
fs.accessSync.We have confirmed that the results are correct on macOS, but not on Windows OS.
I have confirmed that using
fs.openSyncproduces the correct results for Windows OS, but why do these differences occur?Also, there is no mention in the node.js documentation that the behavior changes for each OS, but is using
fs.openSyncthe correct way to check directory permissions on Windows OS?fs.accessSynccheckMac OS
Windows OS
What is the feature you are proposing to solve the problem?
A method that does not return different results on macOS and Windows OS.
Or, we think it would be easier to add an explanation on the documentation to show that the results are different depending on the OS.
What alternatives have you considered?
No response