Skip to content

Commit

Permalink
doc: clarify fs.access works on directories too.
Browse files Browse the repository at this point in the history
Cherry picked from d976d66

PR-URL: #7321
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
lance authored and jasnell committed Jun 21, 2016
1 parent e814416 commit 1e7a7be
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,19 @@ added: v1.0.0
* `mode` {Integer}
* `callback` {Function}

Tests a user's permissions for the file specified by `path`. `mode` is an
optional integer that specifies the accessibility checks to be performed. The
following constants define the possible values of `mode`. It is possible to
create a mask consisting of the bitwise OR of two or more values.

- `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.
Tests a user's permissions for the file or directory specified by `path`.
The `mode` argument is an optional integer that specifies the accessibility
checks to be performed. The following constants define the possible values of
`mode`. It is possible to create a mask consisting of the bitwise OR of two or
more values.

- `fs.F_OK` - `path` 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`).
- `fs.R_OK` - `path` can be read by the calling process.
- `fs.W_OK` - `path` can be written by the calling process.
- `fs.X_OK` - `path` can be executed by the calling process. This has
no effect on Windows (will behave like `fs.F_OK`).

The final argument, `callback`, is a callback function that is invoked with
a possible error argument. If any of the accessibility checks fail, the error
Expand Down

0 comments on commit 1e7a7be

Please sign in to comment.