Skip to content

Commit

Permalink
doc: add fs.open() multiple constants example
Browse files Browse the repository at this point in the history
PR-URL: #33281
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
Ethan-Arrowood authored and codebytere committed May 21, 2020
1 parent e8d6ccb commit 919acee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`][].
Expand Down

0 comments on commit 919acee

Please sign in to comment.