From 37abf87f0e44d0d28ede62fffb31dec5f45c0cc0 Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Sun, 6 May 2018 13:05:21 +0530 Subject: [PATCH 1/4] doc: updates fs doc with - 1. removed extra mode constants doc 2. creates bookmark to the common File Access Contants block. Closes: #20049 --- doc/api/fs.md | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index bace6d94836c23..c0d87e9e9ca0f9 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -746,18 +746,11 @@ changes: 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 +checks to be performed. Check +[`File Access Contants`](#fs_file_access_constants) for possible values of `mode`. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). -* `fs.constants.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.constants.R_OK` - `path` can be read by the calling process. -* `fs.constants.W_OK` - `path` can be written by the calling process. -* `fs.constants.X_OK` - `path` can be executed by the calling process. This has -no effect on Windows (will behave like `fs.constants.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 argument will be an `Error` object. The following examples check if @@ -891,18 +884,10 @@ changes: Synchronously 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 +accessibility checks to be performed. Check [`File Access Contants`](#fs_file_access_constants) for possible values of `mode`. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). -* `fs.constants.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.constants.R_OK` - `path` can be read by the calling process. -* `fs.constants.W_OK` - `path` can be written by the calling process. -* `fs.constants.X_OK` - `path` can be executed by the calling process. This has -no effect on Windows (will behave like `fs.constants.F_OK`). - If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, the method will return `undefined`. @@ -4329,7 +4314,9 @@ The following constants are meant for use with [`fs.access()`][]. F_OK - Flag indicating that the file is visible to the calling process. + Flag indicating that the 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. R_OK @@ -4343,7 +4330,8 @@ The following constants are meant for use with [`fs.access()`][]. X_OK Flag indicating that the file can be executed by the calling - process. + process. This has no effect on Windows + (will behave like fs.constants.F_OK). From 91bb735e2a960d6457df0fb83328d1f617464768 Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Mon, 7 May 2018 11:46:30 +0530 Subject: [PATCH 2/4] doc: review comments 1. use tag 2. bottom bookmark for File Access Constants 3. typo fix Closes: #20049 --- doc/api/fs.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index c0d87e9e9ca0f9..6ebe7697ca84e6 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -746,10 +746,9 @@ changes: 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. Check -[`File Access Contants`](#fs_file_access_constants) for possible values of -`mode`. It is possible to create a mask consisting of the bitwise OR of two or -more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). +checks to be performed. Check [File Access Constants][] for possible values +of `mode`. It is possible to create a mask consisting of the bitwise OR of +two or more values (e.g. `fs.constants.W_OK | fs.constants.R_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 @@ -882,11 +881,12 @@ changes: * `path` {string|Buffer|URL} * `mode` {integer} **Default:** `fs.constants.F_OK` -Synchronously 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. Check [`File Access Contants`](#fs_file_access_constants) for -possible values of `mode`. It is possible to create a mask consisting of the -bitwise OR of two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). +Synchronously 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. Check [File Access Constants][] for +possible values of `mode`. It is possible to create a mask consisting of +the bitwise OR of two or more values +(e.g. `fs.constants.W_OK | fs.constants.R_OK`). If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, the method will return `undefined`. @@ -4316,7 +4316,7 @@ The following constants are meant for use with [`fs.access()`][]. F_OK Flag indicating that the 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. + about rwx permissions. Default if no mode is specified. R_OK @@ -4331,7 +4331,7 @@ The following constants are meant for use with [`fs.access()`][]. X_OK Flag indicating that the file can be executed by the calling process. This has no effect on Windows - (will behave like fs.constants.F_OK). + (will behave like fs.constants.F_OK). @@ -4694,3 +4694,4 @@ the file contents. [Naming Files, Paths, and Namespaces]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx [MSDN-Using-Streams]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb540537.aspx [support of file system `flags`]: #fs_file_system_flags +[File Access Constants]: #fs_file_access_constants From 563b40690d718ce59837be27f8ff250803fa903b Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Mon, 7 May 2018 11:49:59 +0530 Subject: [PATCH 3/4] doc: removes repetition for fsPromises.access Closes: #20049 --- doc/api/fs.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 6ebe7697ca84e6..93cb53318d57b8 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3664,17 +3664,9 @@ added: v10.0.0 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 (e.g. `fs.constants.W_OK | fs.constants.R_OK`). - -* `fs.constants.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.constants.R_OK` - `path` can be read by the calling process. -* `fs.constants.W_OK` - `path` can be written by the calling process. -* `fs.constants.X_OK` - `path` can be executed by the calling process. This has -no effect on Windows (will behave like `fs.constants.F_OK`). +checks to be performed. Check [File Access Constants][] for possible values +`mode`. It is possible to create a mask consisting of the bitwise OR of two +or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). If the accessibility check is successful, the `Promise` is resolved with no value. If any of the accessibility checks fail, the `Promise` is rejected From d42adecebea79d8ac7432457219fe259a2b5367d Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Mon, 7 May 2018 14:26:26 +0530 Subject: [PATCH 4/4] doc: grammar fix ( adds 'of' ). Refs: #20049 --- doc/api/fs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 93cb53318d57b8..0cb1be6b0ea85b 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3665,8 +3665,8 @@ added: v10.0.0 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. Check [File Access Constants][] for possible values -`mode`. It is possible to create a mask consisting of the bitwise OR of two -or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). +of `mode`. It is possible to create a mask consisting of the bitwise OR of +two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`). If the accessibility check is successful, the `Promise` is resolved with no value. If any of the accessibility checks fail, the `Promise` is rejected