mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
fs: remove fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK
PR-URL: https://github.com/nodejs/node/pull/55862 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
e2bc395c42
commit
25dd206c29
4 files changed
+11
-71
No files matched your search
@@ -3589,6 +3589,9 @@ The [`util.toUSVString()`][] API is deprecated. Please use
|
||||
|
||||
<!-- YAML
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/55862
|
||||
description: End-of-Life.
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/49686
|
||||
description: Runtime deprecation.
|
||||
@@ -3597,10 +3600,10 @@ changes:
|
||||
description: Documentation-only deprecation.
|
||||
-->
|
||||
|
||||
Type: Runtime
|
||||
Type: End-of-Life
|
||||
|
||||
`F_OK`, `R_OK`, `W_OK` and `X_OK` getters exposed directly on `node:fs` are
|
||||
deprecated. Get them from `fs.constants` or `fs.promises.constants` instead.
|
||||
`F_OK`, `R_OK`, `W_OK` and `X_OK` getters exposed directly on `node:fs` were
|
||||
removed. Get them from `fs.constants` or `fs.promises.constants` instead.
|
||||
|
||||
### DEP0177: `util.types.isWebAssemblyCompiledModule`
|
||||
|
||||
|
||||
@@ -1927,6 +1927,10 @@ concurrent modifications on the same file or data corruption may occur.
|
||||
<!-- YAML
|
||||
added: v0.11.15
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/55862
|
||||
description: The constants `fs.F_OK`, `fs.R_OK`, `fs.W_OK` and `fs.X_OK`
|
||||
which were present directly on `fs` are removed.
|
||||
- version: v20.8.0
|
||||
pr-url: https://github.com/nodejs/node/pull/49683
|
||||
description: The constants `fs.F_OK`, `fs.R_OK`, `fs.W_OK` and `fs.X_OK`
|
||||
|
||||
@@ -52,9 +52,6 @@ const {
|
||||
S_IFREG,
|
||||
S_IFSOCK,
|
||||
F_OK,
|
||||
R_OK,
|
||||
W_OK,
|
||||
X_OK,
|
||||
O_WRONLY,
|
||||
O_SYMLINK,
|
||||
} = constants;
|
||||
@@ -87,7 +84,6 @@ const {
|
||||
const { toPathIfFileURL } = require('internal/url');
|
||||
const {
|
||||
customPromisifyArgs: kCustomPromisifyArgsSymbol,
|
||||
deprecate,
|
||||
emitExperimentalWarning,
|
||||
getLazy,
|
||||
kEmptyObject,
|
||||
@@ -3358,50 +3354,6 @@ defineLazyProperties(
|
||||
);
|
||||
|
||||
ObjectDefineProperties(fs, {
|
||||
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,
|
||||
|
||||
@@ -1,27 +1,8 @@
|
||||
'use strict';
|
||||
const { expectWarning } = require('../common');
|
||||
require('../common');
|
||||
const fs = require('fs');
|
||||
const assert = require('assert');
|
||||
|
||||
// Check if the two constants accepted by chmod() on Windows are defined.
|
||||
assert.notStrictEqual(fs.constants.S_IRUSR, undefined);
|
||||
assert.notStrictEqual(fs.constants.S_IWUSR, undefined);
|
||||
|
||||
// Check for runtime deprecation warning, there should be no setter
|
||||
const { F_OK, R_OK, W_OK, X_OK } = fs.constants;
|
||||
|
||||
assert.throws(() => { fs.F_OK = 'overwritten'; }, { name: 'TypeError' });
|
||||
assert.throws(() => { fs.R_OK = 'overwritten'; }, { name: 'TypeError' });
|
||||
assert.throws(() => { fs.W_OK = 'overwritten'; }, { name: 'TypeError' });
|
||||
assert.throws(() => { fs.X_OK = 'overwritten'; }, { name: 'TypeError' });
|
||||
|
||||
expectWarning(
|
||||
'DeprecationWarning',
|
||||
'fs.F_OK is deprecated, use fs.constants.F_OK instead',
|
||||
'DEP0176'
|
||||
);
|
||||
|
||||
assert.strictEqual(fs.F_OK, F_OK);
|
||||
assert.strictEqual(fs.R_OK, R_OK);
|
||||
assert.strictEqual(fs.W_OK, W_OK);
|
||||
assert.strictEqual(fs.X_OK, X_OK);
|
||||
Reference in new issue
Block a user