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 Jun 9, 2020
1 parent 7d8a226 commit 9572701
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doc/api/fs.md
Expand Up @@ -5321,6 +5321,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 9572701

Please sign in to comment.