mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
doc: add fs.open() multiple constants example
PR-URL: https://github.com/nodejs/node/pull/33281 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
b02cfef510
commit
c1fe152132
1 file changed
+18
@@ -5434,6 +5434,24 @@ The following constants are exported by `fs.constants`.
|
||||
|
||||
Not every constant will be available on every operating system.
|
||||
|
||||
To use more than one constant, use the bitwise OR `|` operator.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
|
||||
const {
|
||||
O_RDWR,
|
||||
O_CREAT,
|
||||
O_EXCL
|
||||
} = fs.constants;
|
||||
|
||||
fs.open('/path/to/my/file', O_RDWR | O_CREAT | O_EXCL, (err, fd) => {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
|
||||
### File Access Constants
|
||||
|
||||
The following constants are meant for use with [`fs.access()`][].
|
||||
|
||||
Reference in new issue
Block a user