File tree Expand file tree Collapse file tree 2 files changed +49
-5
lines changed Expand file tree Collapse file tree 2 files changed +49
-5
lines changed Original file line number Diff line number Diff line change @@ -3577,12 +3577,15 @@ The [`util.toUSVString()`][] API is deprecated. Please use
3577
3577
3578
3578
<!-- YAML
3579
3579
changes:
3580
+ - version: REPLACEME
3581
+ pr-url: https://github.com/nodejs/node/pull/49686
3582
+ description: Runtime deprecation.
3580
3583
- version: v20.8.0
3581
3584
pr-url: https://github.com/nodejs/node/pull/49683
3582
3585
description: Documentation-only deprecation.
3583
3586
-->
3584
3587
3585
- Type: Documentation-only
3588
+ Type: Runtime
3586
3589
3587
3590
` F_OK ` , ` R_OK ` , ` W_OK ` and ` X_OK ` getters exposed directly on ` node:fs ` are
3588
3591
deprecated. Get them from ` fs.constants ` or ` fs.promises.constants ` instead.
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ const {
87
87
const { toPathIfFileURL } = require ( 'internal/url' ) ;
88
88
const {
89
89
customPromisifyArgs : kCustomPromisifyArgsSymbol ,
90
+ deprecate,
90
91
emitExperimentalWarning,
91
92
getLazy,
92
93
kEmptyObject,
@@ -3274,10 +3275,50 @@ defineLazyProperties(
3274
3275
) ;
3275
3276
3276
3277
ObjectDefineProperties ( fs , {
3277
- F_OK : { __proto__ : null , enumerable : true , value : F_OK || 0 } ,
3278
- R_OK : { __proto__ : null , enumerable : true , value : R_OK || 0 } ,
3279
- W_OK : { __proto__ : null , enumerable : true , value : W_OK || 0 } ,
3280
- X_OK : { __proto__ : null , enumerable : true , value : X_OK || 0 } ,
3278
+ F_OK : {
3279
+ __proto__ : null ,
3280
+ enumerable : false ,
3281
+ get : deprecate (
3282
+ function get ( ) {
3283
+ return F_OK || 0 ;
3284
+ } ,
3285
+ 'fs.F_OK is deprecated, use fs.constants.F_OK instead' ,
3286
+ 'DEP0175' ,
3287
+ ) ,
3288
+ } ,
3289
+ R_OK : {
3290
+ __proto__ : null ,
3291
+ enumerable : false ,
3292
+ get : deprecate (
3293
+ function get ( ) {
3294
+ return R_OK || 0 ;
3295
+ } ,
3296
+ 'fs.R_OK is deprecated, use fs.constants.R_OK instead' ,
3297
+ 'DEP0175' ,
3298
+ ) ,
3299
+ } ,
3300
+ W_OK : {
3301
+ __proto__ : null ,
3302
+ enumerable : false ,
3303
+ get : deprecate (
3304
+ function get ( ) {
3305
+ return W_OK || 0 ;
3306
+ } ,
3307
+ 'fs.W_OK is deprecated, use fs.constants.W_OK instead' ,
3308
+ 'DEP0175' ,
3309
+ ) ,
3310
+ } ,
3311
+ X_OK : {
3312
+ __proto__ : null ,
3313
+ enumerable : false ,
3314
+ get : deprecate (
3315
+ function get ( ) {
3316
+ return X_OK || 0 ;
3317
+ } ,
3318
+ 'fs.X_OK is deprecated, use fs.constants.X_OK instead' ,
3319
+ 'DEP0175' ,
3320
+ ) ,
3321
+ } ,
3281
3322
constants : {
3282
3323
__proto__ : null ,
3283
3324
configurable : false ,
You can’t perform that action at this time.
0 commit comments