Skip to content

Commit c1fe152

Browse files
Ethan-Arrowoodtargos
authored andcommitted
doc: add fs.open() multiple constants example
PR-URL: #33281 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent b02cfef commit c1fe152

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/api/fs.md

+18
Original file line numberDiff line numberDiff line change
@@ -5434,6 +5434,24 @@ The following constants are exported by `fs.constants`.
54345434

54355435
Not every constant will be available on every operating system.
54365436

5437+
To use more than one constant, use the bitwise OR `|` operator.
5438+
5439+
Example:
5440+
5441+
```js
5442+
const fs = require('fs');
5443+
5444+
const {
5445+
O_RDWR,
5446+
O_CREAT,
5447+
O_EXCL
5448+
} = fs.constants;
5449+
5450+
fs.open('/path/to/my/file', O_RDWR | O_CREAT | O_EXCL, (err, fd) => {
5451+
// ...
5452+
});
5453+
```
5454+
54375455
### File Access Constants
54385456

54395457
The following constants are meant for use with [`fs.access()`][].

0 commit comments

Comments
 (0)