Skip to content

Commit d327893

Browse files
shobhitchittoratargos
authored andcommitted
doc: refactor mode constants parts in fs.md
1. removed extra mode constants doc. 2. creates bookmark to the common File Access Contants block. PR-URL: #20558 Fixes: #20049 Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]>
1 parent f55fdd1 commit d327893

File tree

1 file changed

+18
-37
lines changed

1 file changed

+18
-37
lines changed

doc/api/fs.md

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -746,17 +746,9 @@ changes:
746746

747747
Tests a user's permissions for the file or directory specified by `path`.
748748
The `mode` argument is an optional integer that specifies the accessibility
749-
checks to be performed. The following constants define the possible values of
750-
`mode`. It is possible to create a mask consisting of the bitwise OR of two or
751-
more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
752-
753-
* `fs.constants.F_OK` - `path` is visible to the calling process. This is useful
754-
for determining if a file exists, but says nothing about `rwx` permissions.
755-
Default if no `mode` is specified.
756-
* `fs.constants.R_OK` - `path` can be read by the calling process.
757-
* `fs.constants.W_OK` - `path` can be written by the calling process.
758-
* `fs.constants.X_OK` - `path` can be executed by the calling process. This has
759-
no effect on Windows (will behave like `fs.constants.F_OK`).
749+
checks to be performed. Check [File Access Constants][] for possible values
750+
of `mode`. It is possible to create a mask consisting of the bitwise OR of
751+
two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
760752

761753
The final argument, `callback`, is a callback function that is invoked with
762754
a possible error argument. If any of the accessibility checks fail, the error
@@ -889,19 +881,12 @@ changes:
889881
* `path` {string|Buffer|URL}
890882
* `mode` {integer} **Default:** `fs.constants.F_OK`
891883

892-
Synchronously tests a user's permissions for the file or directory specified by
893-
`path`. The `mode` argument is an optional integer that specifies the
894-
accessibility checks to be performed. The following constants define the
895-
possible values of `mode`. It is possible to create a mask consisting of the
896-
bitwise OR of two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
897-
898-
* `fs.constants.F_OK` - `path` is visible to the calling process. This is useful
899-
for determining if a file exists, but says nothing about `rwx` permissions.
900-
Default if no `mode` is specified.
901-
* `fs.constants.R_OK` - `path` can be read by the calling process.
902-
* `fs.constants.W_OK` - `path` can be written by the calling process.
903-
* `fs.constants.X_OK` - `path` can be executed by the calling process. This has
904-
no effect on Windows (will behave like `fs.constants.F_OK`).
884+
Synchronously tests a user's permissions for the file or directory specified
885+
by `path`. The `mode` argument is an optional integer that specifies the
886+
accessibility checks to be performed. Check [File Access Constants][] for
887+
possible values of `mode`. It is possible to create a mask consisting of
888+
the bitwise OR of two or more values
889+
(e.g. `fs.constants.W_OK | fs.constants.R_OK`).
905890

906891
If any of the accessibility checks fail, an `Error` will be thrown. Otherwise,
907892
the method will return `undefined`.
@@ -3679,17 +3664,9 @@ added: v10.0.0
36793664

36803665
Tests a user's permissions for the file or directory specified by `path`.
36813666
The `mode` argument is an optional integer that specifies the accessibility
3682-
checks to be performed. The following constants define the possible values of
3683-
`mode`. It is possible to create a mask consisting of the bitwise OR of two or
3684-
more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
3685-
3686-
* `fs.constants.F_OK` - `path` is visible to the calling process. This is useful
3687-
for determining if a file exists, but says nothing about `rwx` permissions.
3688-
Default if no `mode` is specified.
3689-
* `fs.constants.R_OK` - `path` can be read by the calling process.
3690-
* `fs.constants.W_OK` - `path` can be written by the calling process.
3691-
* `fs.constants.X_OK` - `path` can be executed by the calling process. This has
3692-
no effect on Windows (will behave like `fs.constants.F_OK`).
3667+
checks to be performed. Check [File Access Constants][] for possible values
3668+
of `mode`. It is possible to create a mask consisting of the bitwise OR of
3669+
two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
36933670

36943671
If the accessibility check is successful, the `Promise` is resolved with no
36953672
value. If any of the accessibility checks fail, the `Promise` is rejected
@@ -4329,7 +4306,9 @@ The following constants are meant for use with [`fs.access()`][].
43294306
</tr>
43304307
<tr>
43314308
<td><code>F_OK</code></td>
4332-
<td>Flag indicating that the file is visible to the calling process.</td>
4309+
<td>Flag indicating that the file is visible to the calling process.
4310+
This is useful for determining if a file exists, but says nothing
4311+
about <code>rwx</code> permissions. Default if no mode is specified.</td>
43334312
</tr>
43344313
<tr>
43354314
<td><code>R_OK</code></td>
@@ -4343,7 +4322,8 @@ The following constants are meant for use with [`fs.access()`][].
43434322
<tr>
43444323
<td><code>X_OK</code></td>
43454324
<td>Flag indicating that the file can be executed by the calling
4346-
process.</td>
4325+
process. This has no effect on Windows
4326+
(will behave like <code>fs.constants.F_OK</code>).</td>
43474327
</tr>
43484328
</table>
43494329

@@ -4706,3 +4686,4 @@ the file contents.
47064686
[Naming Files, Paths, and Namespaces]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
47074687
[MSDN-Using-Streams]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb540537.aspx
47084688
[support of file system `flags`]: #fs_file_system_flags
4689+
[File Access Constants]: #fs_file_access_constants

0 commit comments

Comments
 (0)