GeezerVison is showing github.com — src: expose Windows-only fs open flags · nodejs/node@b055a43
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/fs.md +27-1Lines changed: 27 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8728,10 +8728,36 @@ The following constants are meant for use with `fs.open()`. | 8728 | 8728 | is available on Windows operating systems only. On other operating systems, | 8729 | 8729 | this flag is ignored.</td> | 8730 | 8730 | </tr> | | 8731 | + <tr> | | 8732 | + <td><code>UV_FS_O_TEMPORARY</code></td> | | 8733 | + <td>When set, the file is deleted automatically when the last handle to it | | 8734 | + is closed. This flag is available on Windows operating systems only. On | | 8735 | + other operating systems, this flag is ignored.</td> | | 8736 | + </tr> | | 8737 | + <tr> | | 8738 | + <td><code>UV_FS_O_SHORT_LIVED</code></td> | | 8739 | + <td>Hint that the file is short-lived, so the system avoids flushing it to | | 8740 | + disk when possible. This flag is available on Windows operating systems | | 8741 | + only. On other operating systems, this flag is ignored.</td> | | 8742 | + </tr> | | 8743 | + <tr> | | 8744 | + <td><code>UV_FS_O_SEQUENTIAL</code></td> | | 8745 | + <td>Hint that the file is accessed sequentially from beginning to end, to | | 8746 | + optimize caching. This flag is available on Windows operating systems only. | | 8747 | + On other operating systems, this flag is ignored.</td> | | 8748 | + </tr> | | 8749 | + <tr> | | 8750 | + <td><code>UV_FS_O_RANDOM</code></td> | | 8751 | + <td>Hint that the file is accessed randomly, to optimize caching. This flag | | 8752 | + is available on Windows operating systems only. On other operating systems, | | 8753 | + this flag is ignored.</td> | | 8754 | + </tr> | 8731 | 8755 | </table> | 8732 | 8756 |
| 8733 | 8757 | On Windows, only `O_APPEND`, `O_CREAT`, `O_EXCL`, `O_RDONLY`, `O_RDWR`, | 8734 | | -`O_TRUNC`, `O_WRONLY`, and `UV_FS_O_FILEMAP` are available. | | 8758 | +`O_TRUNC`, `O_WRONLY`, `UV_FS_O_FILEMAP`, `UV_FS_O_TEMPORARY`, | | 8759 | +`UV_FS_O_SHORT_LIVED`, `UV_FS_O_SEQUENTIAL`, and `UV_FS_O_RANDOM` are | | 8760 | +available. | 8735 | 8761 |
| 8736 | 8762 | ##### File type constants | 8737 | 8763 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_constants.cc +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1137,7 +1137,12 @@ void DefineFsConstants(Local<Object> target) { | 1137 | 1137 | NODE_DEFINE_CONSTANT(target, O_EXCL); | 1138 | 1138 | #endif | 1139 | 1139 |
| 1140 | | -NODE_DEFINE_CONSTANT(target, UV_FS_O_FILEMAP); | | 1140 | + // Windows-only open flags honored by libuv. They are 0 on other platforms. | | 1141 | + NODE_DEFINE_CONSTANT(target, UV_FS_O_FILEMAP); | | 1142 | + NODE_DEFINE_CONSTANT(target, UV_FS_O_TEMPORARY); | | 1143 | + NODE_DEFINE_CONSTANT(target, UV_FS_O_SHORT_LIVED); | | 1144 | + NODE_DEFINE_CONSTANT(target, UV_FS_O_SEQUENTIAL); | | 1145 | + NODE_DEFINE_CONSTANT(target, UV_FS_O_RANDOM); | 1141 | 1146 |
| 1142 | 1147 | #ifdef O_NOCTTY | 1143 | 1148 | NODE_DEFINE_CONSTANT(target, O_NOCTTY); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-fs-constants.js +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,6 +35,10 @@ const knownFsConstantNames = [ | 35 | 35 | 'O_CREAT', | 36 | 36 | 'O_EXCL', | 37 | 37 | 'UV_FS_O_FILEMAP', | | 38 | + 'UV_FS_O_TEMPORARY', | | 39 | + 'UV_FS_O_SHORT_LIVED', | | 40 | + 'UV_FS_O_SEQUENTIAL', | | 41 | + 'UV_FS_O_RANDOM', | 38 | 42 | 'O_NOCTTY', | 39 | 43 | 'O_TRUNC', | 40 | 44 | 'O_APPEND', | |
|