| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6190552 commit 1dcbf73
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6486,7 +6486,11 @@ operations. | |||
| 6486 | 6486 | ||
| 6487 | 6487 | The following constants are exported by `fs.constants`. | |
| 6488 | 6488 | ||
| 6489 | - Not every constant will be available on every operating system. | ||
| 6489 | + Not every constant will be available on every operating system; | ||
| 6490 | + this is especially important for Windows, where many of the POSIX specific | ||
| 6491 | + definitions are not available. | ||
| 6492 | + For portable applications it is recommended to check for their presence | ||
| 6493 | + before use. | ||
| 6490 | 6494 | ||
| 6491 | 6495 | To use more than one constant, use the bitwise OR `|` operator. | |
| 6492 | 6496 | ||
@@ -6539,6 +6543,8 @@ The following constants are meant for use as the `mode` parameter passed to | |||
| 6539 | 6543 | </tr> | |
| 6540 | 6544 | </table> | |
| 6541 | 6545 | ||
| 6546 | + The definitions are also available on Windows. | ||
| 6547 | + | ||
| 6542 | 6548 | ##### File copy constants | |
| 6543 | 6549 | ||
| 6544 | 6550 | The following constants are meant for use with [`fs.copyFile()`][]. | |
@@ -6567,6 +6573,8 @@ The following constants are meant for use with [`fs.copyFile()`][]. | |||
| 6567 | 6573 | </tr> | |
| 6568 | 6574 | </table> | |
| 6569 | 6575 | ||
| 6576 | + The definitions are also available on Windows. | ||
| 6577 | + | ||
| 6570 | 6578 | ##### File open constants | |
| 6571 | 6579 | ||
| 6572 | 6580 | The following constants are meant for use with `fs.open()`. | |
@@ -6661,6 +6669,9 @@ The following constants are meant for use with `fs.open()`. | |||
| 6661 | 6669 | </tr> | |
| 6662 | 6670 | </table> | |
| 6663 | 6671 | ||
| 6672 | + On Windows, only `O_APPEND`, `O_CREAT`, `O_EXCL`, `O_RDONLY`, `O_RDWR`, | ||
| 6673 | + `O_TRUNC`, `O_WRONLY` and `UV_FS_O_FILEMAP` are available. | ||
| 6674 | + | ||
| 6664 | 6675 | ##### File type constants | |
| 6665 | 6676 | ||
| 6666 | 6677 | The following constants are meant for use with the {fs.Stats} object's | |
@@ -6705,6 +6716,9 @@ The following constants are meant for use with the {fs.Stats} object's | |||
| 6705 | 6716 | </tr> | |
| 6706 | 6717 | </table> | |
| 6707 | 6718 | ||
| 6719 | + On Windows, only `S_IFCHR`, `S_IFDIR`, `S_IFLNK`, `S_IFMT`, and `S_IFREG`, | ||
| 6720 | + are available. | ||
| 6721 | + | ||
| 6708 | 6722 | ##### File mode constants | |
| 6709 | 6723 | ||
| 6710 | 6724 | The following constants are meant for use with the {fs.Stats} object's | |
@@ -6765,6 +6779,8 @@ The following constants are meant for use with the {fs.Stats} object's | |||
| 6765 | 6779 | </tr> | |
| 6766 | 6780 | </table> | |
| 6767 | 6781 | ||
| 6782 | + On Windows, only `S_IRUSR` and `S_IWUSR` are available. | ||
| 6783 | + | ||
| 6768 | 6784 | ## Notes | |
| 6769 | 6785 | ||
| 6770 | 6786 | ### 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