mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
fs: runtime deprecate fs.F_OK
, fs.R_OK
, fs.W_OK
, fs.X_OK
PR-URL: https://github.com/nodejs/node/pull/49686 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
7a461edbbb
commit
b02cd411c2
3 changed files with 69 additions and 6 deletions
49
lib/fs.js
49
lib/fs.js
|
@ -87,6 +87,7 @@ const {
|
|||
const { toPathIfFileURL } = require('internal/url');
|
||||
const {
|
||||
customPromisifyArgs: kCustomPromisifyArgsSymbol,
|
||||
deprecate,
|
||||
emitExperimentalWarning,
|
||||
getLazy,
|
||||
kEmptyObject,
|
||||
|
@ -3274,10 +3275,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',
|
||||
'DEP0176',
|
||||
),
|
||||
},
|
||||
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',
|
||||
'DEP0176',
|
||||
),
|
||||
},
|
||||
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',
|
||||
'DEP0176',
|
||||
),
|
||||
},
|
||||
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',
|
||||
'DEP0176',
|
||||
),
|
||||
},
|
||||
constants: {
|
||||
__proto__: null,
|
||||
configurable: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue