From c1fe1521320c643ff1dae4e9b129cb3a511ab682 Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Thu, 7 May 2020 11:18:20 -0400 Subject: [PATCH] doc: add fs.open() multiple constants example PR-URL: https://github.com/nodejs/node/pull/33281 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- doc/api/fs.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 2fc687d6aad04c..c52c622f07029f 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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()`][].