Skip to content

Commit

Permalink
fs: runtime deprecate fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed Sep 17, 2023
1 parent 56ecf29 commit 7a9498e
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const {
const { toPathIfFileURL } = require('internal/url');
const {
customPromisifyArgs: kCustomPromisifyArgsSymbol,
deprecate,
kEmptyObject,
promisify: {
custom: kCustomPromisifiedSymbol,
Expand Down Expand Up @@ -3241,10 +3242,50 @@ defineLazyProperties(
);

ObjectDefineProperties(fs, {
F_OK: { __proto__: null, enumerable: true, value: F_OK || 0 },
R_OK: { __proto__: null, enumerable: true, value: R_OK || 0 },
W_OK: { __proto__: null, enumerable: true, value: W_OK || 0 },
X_OK: { __proto__: null, enumerable: true, value: X_OK || 0 },
F_OK: {
__proto__: null,
enumerable: false,
get: deprecate(
function get() {
return F_OK || 0;
},
'fs.F_OK is deprecated, use fs.constants.F_OK instead',
'DEP0175',
),
},
R_OK: {
__proto__: null,
enumerable: false,
get: deprecate(
function get() {
return R_OK || 0;
},
'fs.R_OK is deprecated, use fs.constants.R_OK instead',
'DEP0175',
),
},
W_OK: {
__proto__: null,
enumerable: false,
get: deprecate(
function get() {
return W_OK || 0;
},
'fs.W_OK is deprecated, use fs.constants.W_OK instead',
'DEP0175',
),
},
X_OK: {
__proto__: null,
enumerable: false,
get: deprecate(
function get() {
return X_OK || 0;
},
'fs.X_OK is deprecated, use fs.constants.X_OK instead',
'DEP0175',
),
},
constants: {
__proto__: null,
configurable: false,
Expand Down

0 comments on commit 7a9498e

Please sign in to comment.