Skip to content

Commit 21f59ec

Browse files
committed
fs: emit experimental warning for fs.promises
1 parent 71c3905 commit 21f59ec

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/fs.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,7 +2508,7 @@ async function writeEverything(fd, buffer, offset, length, position) {
25082508
}
25092509
}
25102510

2511-
fs.promises = {
2511+
const promises = {
25122512
async access(path, mode = fs.F_OK) {
25132513
handleError((path = getPathFromURL(path)));
25142514
nullCheck(path);
@@ -2908,7 +2908,7 @@ fs.promises = {
29082908

29092909

29102910
if (constants.O_SYMLINK !== undefined) {
2911-
Object.assign(fs.promises, {
2911+
Object.assign(promises, {
29122912
async lchmod(path, mode) {
29132913
const fd = await fs.promises.open(path,
29142914
constants.O_WRONLY |
@@ -2924,3 +2924,12 @@ if (constants.O_SYMLINK !== undefined) {
29242924
}
29252925
});
29262926
}
2927+
2928+
Object.defineProperty(fs, 'promises', {
2929+
configurable: true,
2930+
enumerable: true,
2931+
get() {
2932+
require('internal/util').emitExperimentalWarning('fs.promises');
2933+
return promises;
2934+
}
2935+
});

0 commit comments

Comments
 (0)