Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.access docs inconsistency with files/directories #7110

Closed
cpojer opened this issue Jun 2, 2016 · 4 comments
Closed

fs.access docs inconsistency with files/directories #7110

cpojer opened this issue Jun 2, 2016 · 4 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@cpojer
Copy link

cpojer commented Jun 2, 2016

  • Version: 6

The docs say:
fs.R_OK - File can be read by the calling process.

However, fs.accessSync('path/to/directory', fs.R_OK) will succeed if the path maps to a directory instead of a file. I don't know if this is the expected behavior of accessSync but at least there should be a clarification in the documentation. Currently the documentation reads like it would succeed only for files and not for directories.

See: https://nodejs.org/api/fs.html#fs_fs_access_path_mode_callback

@mscdex mscdex added the fs Issues and PRs related to the fs subsystem / file system. label Jun 2, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Jun 2, 2016

Documentation PRs are welcome :-)

@cpojer
Copy link
Author

cpojer commented Jun 2, 2016

It makes sense first to figure out whether the intent of access is to work on directories and files the same.

@cjihrig
Copy link
Contributor

cjihrig commented Jun 2, 2016

The intent is to work the same.

@lance
Copy link
Member

lance commented Jun 2, 2016

Presumably, that's the intent for all modes, correct?

  • fs.F_OK - File is visible to the calling process. This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.
  • fs.R_OK - File can be read by the calling process.
  • fs.W_OK - File can be written by the calling process.
  • fs.X_OK - File can be executed by the calling process. This has no effect on Windows (will behave like fs.F_OK).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

4 participants