| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5d15eb1 commit 1976284
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6771,7 +6771,11 @@ operations. | |||
| 6771 | 6771 | ||
| 6772 | 6772 | The following constants are exported by `fs.constants`. | |
| 6773 | 6773 | ||
| 6774 | - Not every constant will be available on every operating system. | ||
| 6774 | + Not every constant will be available on every operating system; | ||
| 6775 | + this is especially important for Windows, where many of the POSIX specific | ||
| 6776 | + definitions are not available. | ||
| 6777 | + For portable applications it is recommended to check for their presence | ||
| 6778 | + before use. | ||
| 6775 | 6779 | ||
| 6776 | 6780 | To use more than one constant, use the bitwise OR `|` operator. | |
| 6777 | 6781 | ||
@@ -6824,6 +6828,8 @@ The following constants are meant for use as the `mode` parameter passed to | |||
| 6824 | 6828 | </tr> | |
| 6825 | 6829 | </table> | |
| 6826 | 6830 | ||
| 6831 | + The definitions are also available on Windows. | ||
| 6832 | + | ||
| 6827 | 6833 | ##### File copy constants | |
| 6828 | 6834 | ||
| 6829 | 6835 | The following constants are meant for use with [`fs.copyFile()`][]. | |
@@ -6852,6 +6858,8 @@ The following constants are meant for use with [`fs.copyFile()`][]. | |||
| 6852 | 6858 | </tr> | |
| 6853 | 6859 | </table> | |
| 6854 | 6860 | ||
| 6861 | + The definitions are also available on Windows. | ||
| 6862 | + | ||
| 6855 | 6863 | ##### File open constants | |
| 6856 | 6864 | ||
| 6857 | 6865 | The following constants are meant for use with `fs.open()`. | |
@@ -6946,6 +6954,9 @@ The following constants are meant for use with `fs.open()`. | |||
| 6946 | 6954 | </tr> | |
| 6947 | 6955 | </table> | |
| 6948 | 6956 | ||
| 6957 | + On Windows, only `O_APPEND`, `O_CREAT`, `O_EXCL`, `O_RDONLY`, `O_RDWR`, | ||
| 6958 | + `O_TRUNC`, `O_WRONLY` and `UV_FS_O_FILEMAP` are available. | ||
| 6959 | + | ||
| 6949 | 6960 | ##### File type constants | |
| 6950 | 6961 | ||
| 6951 | 6962 | 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 | |||
| 6990 | 7001 | </tr> | |
| 6991 | 7002 | </table> | |
| 6992 | 7003 | ||
| 7004 | + On Windows, only `S_IFCHR`, `S_IFDIR`, `S_IFLNK`, `S_IFMT`, and `S_IFREG`, | ||
| 7005 | + are available. | ||
| 7006 | + | ||
| 6993 | 7007 | ##### File mode constants | |
| 6994 | 7008 | ||
| 6995 | 7009 | 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 | |||
| 7050 | 7064 | </tr> | |
| 7051 | 7065 | </table> | |
| 7052 | 7066 | ||
| 7067 | + On Windows, only `S_IRUSR` and `S_IWUSR` are available. | ||
| 7068 | + | ||
| 7053 | 7069 | ## Notes | |
| 7054 | 7070 | ||
| 7055 | 7071 | ### Ordering of callback and promise-based operations | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,16 @@ | |||
| 47 | 47 | #include <dlfcn.h> | |
| 48 | 48 | #endif | |
| 49 | 49 | ||
| 50 | + #if defined(_WIN32) | ||
| 51 | + #include <io.h> // _S_IREAD _S_IWRITE | ||
| 52 | + #ifndef S_IRUSR | ||
| 53 | + #define S_IRUSR _S_IREAD | ||
| 54 | + #endif // S_IRUSR | ||
| 55 | + #ifndef S_IWUSR | ||
| 56 | + #define S_IWUSR _S_IWRITE | ||
| 57 | + #endif // S_IWUSR | ||
| 58 | + #endif | ||
| 59 | + | ||
| 50 | 60 | #include <cerrno> | |
| 51 | 61 | #include <csignal> | |
| 52 | 62 | #include <limits> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,8 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + const fs = require('fs'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + | ||
| 6 | + // Check if the two constants accepted by chmod() on Windows are defined. | ||
| 7 | + assert.notStrictEqual(fs.constants.S_IRUSR, undefined); | ||
| 8 | + assert.notStrictEqual(fs.constants.S_IWUSR, undefined); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments