Skip to content

Commit

Permalink
fs: export constants from fs/promises
Browse files Browse the repository at this point in the history
  • Loading branch information
F3n67u committed May 27, 2022
1 parent 40162db commit 898deaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/internal/fs/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const {
Uint8Array,
} = primordials;

const { fs: constants } = internalBinding('constants');
const {
F_OK,
O_SYMLINK,
O_WRONLY,
S_IFMT,
S_IFREG
} = internalBinding('constants').fs;
} = constants;

const binding = internalBinding('fs');
const { Buffer } = require('buffer');

Expand Down Expand Up @@ -899,6 +901,7 @@ module.exports = {
appendFile,
readFile,
watch,
constants,
},

FileHandle,
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-fs-promises-exists.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

require('../common');
const assert = require('assert');
const fs = require('fs');
const fsPromises = require('fs/promises');

assert.strictEqual(require('fs/promises'), require('fs').promises);
assert.strictEqual(fsPromises, fs.promises);
assert.strictEqual(fsPromises.constants, fs.constants);

0 comments on commit 898deaa

Please sign in to comment.