diff options
author | Liviu Ionescu <ilg@livius.net> | 2022-04-21 07:29:31 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2022-04-28 07:56:14 +0300 |
commit | 1976284a92c661b9578828ed8c412fef8e6587bb (patch) | |
tree | 1c8604a6b2b98fc5fe84498d04c65fce1c9bd8c7 /doc/api/fs.md | |
parent | 5d15eb1a1491aee17e9d347c4376060eacb2ccb7 (diff) |
src: define fs.constants.S_IWUSR & S_IRUSR for Win
On Windows, most of the POSIX file mode definitions are not available.
However, functionally equivalent read/write definitions exists, and
chmod() can use them. This patch defines two aliases, so that these
definintions are issued in fs.constants.
fixes: https://github.com/nodejs/node/issues/41591
PR-URL: https://github.com/nodejs/node/pull/42757
Refs: https://github.com/nodejs/node/issues/41591
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/fs.md')
-rw-r--r-- | doc/api/fs.md | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md index 246b369f318..46a15ba5473 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -6771,7 +6771,11 @@ operations. The following constants are exported by `fs.constants`. -Not every constant will be available on every operating system. +Not every constant will be available on every operating system; +this is especially important for Windows, where many of the POSIX specific +definitions are not available. +For portable applications it is recommended to check for their presence +before use. To use more than one constant, use the bitwise OR `|` operator. @@ -6824,6 +6828,8 @@ The following constants are meant for use as the `mode` parameter passed to </tr> </table> +The definitions are also available on Windows. + ##### File copy constants The following constants are meant for use with [`fs.copyFile()`][]. @@ -6852,6 +6858,8 @@ The following constants are meant for use with [`fs.copyFile()`][]. </tr> </table> +The definitions are also available on Windows. + ##### File open constants The following constants are meant for use with `fs.open()`. @@ -6946,6 +6954,9 @@ The following constants are meant for use with `fs.open()`. </tr> </table> +On Windows, only `O_APPEND`, `O_CREAT`, `O_EXCL`, `O_RDONLY`, `O_RDWR`, +`O_TRUNC`, `O_WRONLY` and `UV_FS_O_FILEMAP` are available. + ##### File type constants The following constants are meant for use with the {fs.Stats} object's @@ -6990,6 +7001,9 @@ The following constants are meant for use with the {fs.Stats} object's </tr> </table> +On Windows, only `S_IFCHR`, `S_IFDIR`, `S_IFLNK`, `S_IFMT`, and `S_IFREG`, +are available. + ##### File mode constants The following constants are meant for use with the {fs.Stats} object's @@ -7050,6 +7064,8 @@ The following constants are meant for use with the {fs.Stats} object's </tr> </table> +On Windows, only `S_IRUSR` and `S_IWUSR` are available. + ## Notes ### Ordering of callback and promise-based operations |