From 20a13bf604dbd8a5becc35ee8140b30d383b48f2 Mon Sep 17 00:00:00 2001 From: JonasBa Date: Mon, 5 Aug 2024 16:22:08 -0400 Subject: [PATCH] fs: fix name arg for validation --- lib/fs.js | 363 +++++++++++++++++++++++++++++------------------------- 1 file changed, 195 insertions(+), 168 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 2a686ca23046b6..f955e930262702 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -72,36 +72,24 @@ const BufferToString = uncurryThis(Buffer.prototype.toString); const { AbortError, aggregateTwoErrors, - codes: { - ERR_ACCESS_DENIED, - ERR_FS_FILE_TOO_LARGE, - ERR_INVALID_ARG_VALUE, - }, + codes: { ERR_ACCESS_DENIED, ERR_FS_FILE_TOO_LARGE, ERR_INVALID_ARG_VALUE }, } = require('internal/errors'); -const { - FSReqCallback, - statValues, -} = binding; +const { FSReqCallback, statValues } = binding; const { toPathIfFileURL } = require('internal/url'); const { customPromisifyArgs: kCustomPromisifyArgsSymbol, emitExperimentalWarning, getLazy, kEmptyObject, - promisify: { - custom: kCustomPromisifiedSymbol, - }, + promisify: { custom: kCustomPromisifiedSymbol }, SideEffectFreeRegExpPrototypeExec, defineLazyProperties, isWindows, isMacOS, } = require('internal/util'); const { - constants: { - kIoMaxLength, - kMaxUserId, - }, + constants: { kIoMaxLength, kMaxUserId }, copyObject, Dirent, emitRecursiveRmdirWarning, @@ -172,8 +160,10 @@ function showTruncateDeprecation() { if (truncateWarn) { process.emitWarning( 'Using fs.truncate with a file descriptor is deprecated. Please use ' + - 'fs.ftruncate with a file descriptor instead.', - 'DeprecationWarning', 'DEP0081'); + 'fs.ftruncate with a file descriptor instead.', + 'DeprecationWarning', + 'DEP0081', + ); truncateWarn = false; } } @@ -205,8 +195,7 @@ function isFileType(stats, fileType) { // Use stats array directly to avoid creating an fs.Stats instance just for // our internal use. let mode = stats[1]; - if (typeof mode === 'bigint') - mode = Number(mode); + if (typeof mode === 'bigint') mode = Number(mode); return (mode & S_IFMT) === fileType; } @@ -265,7 +254,8 @@ function exists(path, callback) { ObjectDefineProperty(exists, kCustomPromisifiedSymbol, { __proto__: null, - value: function exists(path) { // eslint-disable-line func-name-matching + value: function exists(path) { + // eslint-disable-line func-name-matching return new Promise((resolve) => fs.exists(path, resolve)); }, }); @@ -310,13 +300,12 @@ function readFileAfterOpen(err, fd) { function readFileAfterStat(err, stats) { const context = this.context; - if (err) - return context.close(err); + if (err) return context.close(err); // TODO(BridgeAR): Check if allocating a smaller chunk is better performance // wise, similar to the promise based version (less peak memory and chunked // stringify operations vs multiple C++/JS boundary crossings). - const size = context.size = isFileType(stats, S_IFREG) ? stats[8] : 0; + const size = (context.size = isFileType(stats, S_IFREG) ? stats[8] : 0); if (size > kIoMaxLength) { err = new ERR_FS_FILE_TOO_LARGE(size); @@ -377,8 +366,7 @@ function readFile(path, options, callback) { return; } - if (checkAborted(options.signal, callback)) - return; + if (checkAborted(options.signal, callback)) return; const flagsNumber = stringToFlags(options.flag, 'options.flag'); const req = new FSReqCallback(); @@ -476,8 +464,7 @@ function readFileSync(path, options) { } while (bytesRead !== 0); } - if (!isUserFd) - fs.closeSync(fd); + if (!isUserFd) fs.closeSync(fd); if (size === 0) { // Data was collected into the buffers list. @@ -501,8 +488,7 @@ function defaultCloseCallback(err) { * @returns {void} */ function close(fd, callback = defaultCloseCallback) { - if (callback !== defaultCloseCallback) - callback = makeCallback(callback); + if (callback !== defaultCloseCallback) callback = makeCallback(callback); const req = new FSReqCallback(); req.oncomplete = callback; @@ -654,8 +640,11 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) { } if (buffer.byteLength === 0) { - throw new ERR_INVALID_ARG_VALUE('buffer', buffer, - 'is empty and cannot be written'); + throw new ERR_INVALID_ARG_VALUE( + 'buffer', + buffer, + 'is empty and cannot be written', + ); } validateOffsetLengthRead(offset, length, buffer.byteLength); @@ -677,8 +666,11 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) { binding.read(fd, buffer, offset, length, position, req); } -ObjectDefineProperty(read, kCustomPromisifyArgsSymbol, - { __proto__: null, value: ['bytesRead', 'buffer'], enumerable: false }); +ObjectDefineProperty(read, kCustomPromisifyArgsSymbol, { + __proto__: null, + value: ['bytesRead', 'buffer'], + enumerable: false, +}); /** * Synchronously reads the file from the @@ -725,8 +717,11 @@ function readSync(fd, buffer, offsetOrOptions, length, position) { } if (buffer.byteLength === 0) { - throw new ERR_INVALID_ARG_VALUE('buffer', buffer, - 'is empty and cannot be written'); + throw new ERR_INVALID_ARG_VALUE( + 'buffer', + buffer, + 'is empty and cannot be written', + ); } validateOffsetLengthRead(offset, length, buffer.byteLength); @@ -766,14 +761,16 @@ function readv(fd, buffers, position, callback) { const req = new FSReqCallback(); req.oncomplete = wrapper; - if (typeof position !== 'number') - position = null; + if (typeof position !== 'number') position = null; binding.readBuffers(fd, buffers, position, req); } -ObjectDefineProperty(readv, kCustomPromisifyArgsSymbol, - { __proto__: null, value: ['bytesRead', 'buffers'], enumerable: false }); +ObjectDefineProperty(readv, kCustomPromisifyArgsSymbol, { + __proto__: null, + value: ['bytesRead', 'buffers'], + enumerable: false, +}); /** * Synchronously reads file from the @@ -788,8 +785,7 @@ function readvSync(fd, buffers, position) { fd = getValidatedFd(fd); validateBufferArray(buffers); - if (typeof position !== 'number') - position = null; + if (typeof position !== 'number') position = null; return binding.readBuffers(fd, buffers, position); } @@ -834,10 +830,8 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) { } else { validateInteger(offset, 'offset', 0); } - if (typeof length !== 'number') - length = buffer.byteLength - offset; - if (typeof position !== 'number') - position = null; + if (typeof length !== 'number') length = buffer.byteLength - offset; + if (typeof position !== 'number') position = null; validateOffsetLengthWrite(offset, length, buffer.byteLength); const req = new FSReqCallback(); @@ -868,8 +862,11 @@ function write(fd, buffer, offsetOrOptions, length, position, callback) { binding.writeString(fd, str, offset, length, req); } -ObjectDefineProperty(write, kCustomPromisifyArgsSymbol, - { __proto__: null, value: ['bytesWritten', 'buffer'], enumerable: false }); +ObjectDefineProperty(write, kCustomPromisifyArgsSymbol, { + __proto__: null, + value: ['bytesWritten', 'buffer'], + enumerable: false, +}); /** * Synchronously writes `buffer` to the @@ -899,26 +896,29 @@ function writeSync(fd, buffer, offsetOrOptions, length, position) { position = null, } = offsetOrOptions ?? kEmptyObject); } - if (position === undefined) - position = null; + if (position === undefined) position = null; if (offset == null) { offset = 0; } else { validateInteger(offset, 'offset', 0); } - if (typeof length !== 'number') - length = buffer.byteLength - offset; + if (typeof length !== 'number') length = buffer.byteLength - offset; validateOffsetLengthWrite(offset, length, buffer.byteLength); - result = binding.writeBuffer(fd, buffer, offset, length, position, - undefined, ctx); + result = binding.writeBuffer( + fd, + buffer, + offset, + length, + position, + undefined, + ctx, + ); } else { validateStringAfterArrayBufferView(buffer, 'buffer'); validateEncoding(buffer, length); - if (offset === undefined) - offset = null; - result = binding.writeString(fd, buffer, offset, length, - undefined, ctx); + if (offset === undefined) offset = null; + result = binding.writeString(fd, buffer, offset, length, undefined, ctx); } handleErrorFromBinding(ctx); return result; @@ -955,8 +955,7 @@ function writev(fd, buffers, position, callback) { const req = new FSReqCallback(); req.oncomplete = wrapper; - if (typeof position !== 'number') - position = null; + if (typeof position !== 'number') position = null; binding.writeBuffers(fd, buffers, position, req); } @@ -983,8 +982,7 @@ function writevSync(fd, buffers, position) { return 0; } - if (typeof position !== 'number') - position = null; + if (typeof position !== 'number') position = null; return binding.writeBuffers(fd, buffers, position); } @@ -1008,7 +1006,6 @@ function rename(oldPath, newPath, callback) { ); } - /** * Synchronously renames file at `oldPath` to * the pathname provided as `newPath`. @@ -1122,8 +1119,7 @@ function lazyLoadCp() { } function lazyLoadRimraf() { - if (rimraf === undefined) - ({ rimraf } = require('internal/fs/rimraf')); + if (rimraf === undefined) ({ rimraf } = require('internal/fs/rimraf')); } /** @@ -1165,7 +1161,8 @@ function rmdir(path, options, callback) { lazyLoadRimraf(); rimraf(path, options, callback); - }); + }, + ); } else { validateRmdirOptions(options); const req = new FSReqCallback(); @@ -1191,7 +1188,12 @@ function rmdirSync(path, options) { emitRecursiveRmdirWarning(); options = validateRmOptionsSync(path, { ...options, force: false }, true); if (options !== false) { - return binding.rmSync(path, options.maxRetries, options.recursive, options.retryDelay); + return binding.rmSync( + path, + options.maxRetries, + options.recursive, + options.retryDelay, + ); } } else { validateRmdirOptions(options); @@ -1243,7 +1245,12 @@ function rm(path, options, callback) { */ function rmSync(path, options) { const opts = validateRmOptionsSync(path, options, false); - return binding.rmSync(getValidatedPath(path), opts.maxRetries, opts.recursive, opts.retryDelay); + return binding.rmSync( + getValidatedPath(path), + opts.maxRetries, + opts.recursive, + opts.retryDelay, + ); } /** @@ -1314,7 +1321,7 @@ function mkdir(path, options, callback) { } else if (options) { if (options.recursive !== undefined) { recursive = options.recursive; - validateBoolean(recursive); + validateBoolean(recursive, 'options.recursive'); } if (options.mode !== undefined) { mode = parseFileMode(options.mode, 'options.mode'); @@ -1324,12 +1331,7 @@ function mkdir(path, options, callback) { const req = new FSReqCallback(); req.oncomplete = callback; - binding.mkdir( - getValidatedPath(path), - mode, - recursive, - req, - ); + binding.mkdir(getValidatedPath(path), mode, recursive, req); } /** @@ -1356,11 +1358,7 @@ function mkdirSync(path, options) { } } - const result = binding.mkdir( - getValidatedPath(path), - mode, - recursive, - ); + const result = binding.mkdir(getValidatedPath(path), mode, recursive); if (recursive) { return result; @@ -1383,11 +1381,7 @@ function readdirSyncRecursive(basePath, options) { const pathsQueue = [basePath]; function read(path) { - const readdirResult = binding.readdir( - path, - encoding, - withFileTypes, - ); + const readdirResult = binding.readdir(path, encoding, withFileTypes); if (readdirResult === undefined) { return; @@ -1400,10 +1394,17 @@ function readdirSyncRecursive(basePath, options) { // of the first array within the result. const length = readdirResult[0].length; for (let i = 0; i < length; i++) { - const dirent = getDirent(path, readdirResult[0][i], readdirResult[1][i]); + const dirent = getDirent( + path, + readdirResult[0][i], + readdirResult[1][i], + ); ArrayPrototypePush(readdirResults, dirent); if (dirent.isDirectory()) { - ArrayPrototypePush(pathsQueue, pathModule.join(dirent.parentPath, dirent.name)); + ArrayPrototypePush( + pathsQueue, + pathModule.join(dirent.parentPath, dirent.name), + ); } } } else { @@ -1466,12 +1467,7 @@ function readdir(path, options, callback) { getDirents(path, result, callback); }; } - binding.readdir( - path, - options.encoding, - !!options.withFileTypes, - req, - ); + binding.readdir(path, options.encoding, !!options.withFileTypes, req); } /** @@ -1501,7 +1497,9 @@ function readdirSync(path, options) { !!options.withFileTypes, ); - return result !== undefined && options.withFileTypes ? getDirents(path, result) : result; + return result !== undefined && options.withFileTypes + ? getDirents(path, result) + : result; } /** @@ -1546,7 +1544,13 @@ function lstat(path, options = { bigint: false }, callback) { callback = makeStatsCallback(callback); path = getValidatedPath(path); if (permission.isEnabled() && !permission.has('fs.read', path)) { - callback(new ERR_ACCESS_DENIED('Access to this API has been restricted', 'FileSystemRead', path)); + callback( + new ERR_ACCESS_DENIED( + 'Access to this API has been restricted', + 'FileSystemRead', + path, + ), + ); return; } @@ -1623,7 +1627,11 @@ function fstatSync(fd, options = { bigint: false }) { function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) { path = getValidatedPath(path); if (permission.isEnabled() && !permission.has('fs.read', path)) { - throw new ERR_ACCESS_DENIED('Access to this API has been restricted', 'FileSystemRead', path); + throw new ERR_ACCESS_DENIED( + 'Access to this API has been restricted', + 'FileSystemRead', + path, + ); } const stats = binding.lstat( getValidatedPath(path), @@ -1721,7 +1729,10 @@ function symlink(target, path, type, callback) { callback(new ERR_ACCESS_DENIED('relative symbolic link target')); return; } - } else if (typeof target !== 'string' || !isAbsolute(toPathIfFileURL(target))) { + } else if ( + typeof target !== 'string' || + !isAbsolute(toPathIfFileURL(target)) + ) { callback(new ERR_ACCESS_DENIED('relative symbolic link target')); return; } @@ -1746,18 +1757,15 @@ function symlink(target, path, type, callback) { stat(absoluteTarget, (err, stat) => { const resolvedType = !err && stat.isDirectory() ? 'dir' : 'file'; const resolvedFlags = stringToSymlinkType(resolvedType); - const destination = preprocessSymlinkDestination(target, - resolvedType, - path); + const destination = preprocessSymlinkDestination( + target, + resolvedType, + path, + ); const req = new FSReqCallback(); req.oncomplete = callback; - binding.symlink( - destination, - path, - resolvedFlags, - req, - ); + binding.symlink(destination, path, resolvedFlags, req); }); return; } @@ -1795,7 +1803,10 @@ function symlinkSync(target, path, type) { if (!isAbsolute(BufferToString(target))) { throw new ERR_ACCESS_DENIED('relative symbolic link target'); } - } else if (typeof target !== 'string' || !isAbsolute(toPathIfFileURL(target))) { + } else if ( + typeof target !== 'string' || + !isAbsolute(toPathIfFileURL(target)) + ) { throw new ERR_ACCESS_DENIED('relative symbolic link target'); } } @@ -1841,10 +1852,7 @@ function linkSync(existingPath, newPath) { existingPath = getValidatedPath(existingPath, 'existingPath'); newPath = getValidatedPath(newPath, 'newPath'); - binding.link( - existingPath, - newPath, - ); + binding.link(existingPath, newPath); } /** @@ -1881,7 +1889,11 @@ function fchmod(fd, mode, callback) { callback = makeCallback(callback); if (permission.isEnabled()) { - callback(new ERR_ACCESS_DENIED('fchmod API is disabled when Permission Model is enabled.')); + callback( + new ERR_ACCESS_DENIED( + 'fchmod API is disabled when Permission Model is enabled.', + ), + ); return; } @@ -1898,12 +1910,11 @@ function fchmod(fd, mode, callback) { */ function fchmodSync(fd, mode) { if (permission.isEnabled()) { - throw new ERR_ACCESS_DENIED('fchmod API is disabled when Permission Model is enabled.'); + throw new ERR_ACCESS_DENIED( + 'fchmod API is disabled when Permission Model is enabled.', + ); } - binding.fchmod( - fd, - parseFileMode(mode, 'mode'), - ); + binding.fchmod(fd, parseFileMode(mode, 'mode')); } /** @@ -2024,7 +2035,11 @@ function fchown(fd, uid, gid, callback) { validateInteger(gid, 'gid', -1, kMaxUserId); callback = makeCallback(callback); if (permission.isEnabled()) { - callback(new ERR_ACCESS_DENIED('fchown API is disabled when Permission Model is enabled.')); + callback( + new ERR_ACCESS_DENIED( + 'fchown API is disabled when Permission Model is enabled.', + ), + ); return; } @@ -2044,7 +2059,9 @@ function fchownSync(fd, uid, gid) { validateInteger(uid, 'uid', -1, kMaxUserId); validateInteger(gid, 'gid', -1, kMaxUserId); if (permission.isEnabled()) { - throw new ERR_ACCESS_DENIED('fchown API is disabled when Permission Model is enabled.'); + throw new ERR_ACCESS_DENIED( + 'fchown API is disabled when Permission Model is enabled.', + ); } binding.fchown(fd, uid, gid); @@ -2100,12 +2117,7 @@ function utimes(path, atime, mtime, callback) { const req = new FSReqCallback(); req.oncomplete = callback; - binding.utimes( - path, - toUnixTimestamp(atime), - toUnixTimestamp(mtime), - req, - ); + binding.utimes(path, toUnixTimestamp(atime), toUnixTimestamp(mtime), req); } /** @@ -2175,12 +2187,7 @@ function lutimes(path, atime, mtime, callback) { const req = new FSReqCallback(); req.oncomplete = callback; - binding.lutimes( - path, - toUnixTimestamp(atime), - toUnixTimestamp(mtime), - req, - ); + binding.lutimes(path, toUnixTimestamp(atime), toUnixTimestamp(mtime), req); } /** @@ -2199,7 +2206,16 @@ function lutimesSync(path, atime, mtime) { ); } -function writeAll(fd, isUserFd, buffer, offset, length, signal, flush, callback) { +function writeAll( + fd, + isUserFd, + buffer, + offset, + length, + signal, + flush, + callback, +) { if (signal?.aborted) { const abortError = new AbortError(undefined, { cause: signal?.reason }); if (isUserFd) { @@ -2293,8 +2309,7 @@ function writeFile(path, data, options, callback) { return; } - if (checkAborted(options.signal, callback)) - return; + if (checkAborted(options.signal, callback)) return; fs.open(path, flag, options.mode, (openErr, fd) => { if (openErr) { @@ -2334,7 +2349,10 @@ function writeFileSync(path, data, options) { const flag = options.flag || 'w'; // C++ fast path for string data and UTF8 encoding - if (typeof data === 'string' && (options.encoding === 'utf8' || options.encoding === 'utf-8')) { + if ( + typeof data === 'string' && + (options.encoding === 'utf8' || options.encoding === 'utf-8') + ) { if (!isInt32(path)) { path = getValidatedPath(path); } @@ -2394,8 +2412,7 @@ function appendFile(path, data, options, callback) { options = copyObject(options); // Force append behavior when using a supplied file descriptor - if (!options.flag || isFd(path)) - options.flag = 'a'; + if (!options.flag || isFd(path)) options.flag = 'a'; fs.writeFile(path, data, options, callback); } @@ -2418,8 +2435,7 @@ function appendFileSync(path, data, options) { options = copyObject(options); // Force append behavior when using a supplied file descriptor - if (!options.flag || isFd(path)) - options.flag = 'a'; + if (!options.flag || isFd(path)) options.flag = 'a'; fs.writeFileSync(path, data, options); } @@ -2463,10 +2479,12 @@ function watch(filename, options, listener) { watcher[watchers.kFSWatchStart](path); } else { watcher = new watchers.FSWatcher(); - watcher[watchers.kFSWatchStart](path, - options.persistent, - options.recursive, - options.encoding); + watcher[watchers.kFSWatchStart]( + path, + options.persistent, + options.recursive, + options.encoding, + ); } if (listener) { @@ -2477,8 +2495,12 @@ function watch(filename, options, listener) { process.nextTick(() => watcher.close()); } else { const listener = () => watcher.close(); - kResistStopPropagation ??= require('internal/event_target').kResistStopPropagation; - options.signal.addEventListener('abort', listener, { __proto__: null, [kResistStopPropagation]: true }); + kResistStopPropagation ??= + require('internal/event_target').kResistStopPropagation; + options.signal.addEventListener('abort', listener, { + __proto__: null, + [kResistStopPropagation]: true, + }); watcher.once('close', () => { options.signal.removeEventListener('abort', listener); }); @@ -2488,7 +2510,6 @@ function watch(filename, options, listener) { return watcher; } - const statWatchers = new SafeMap(); /** @@ -2530,8 +2551,11 @@ function watchFile(filename, options, listener) { const watchers = require('internal/fs/watchers'); if (stat === undefined) { stat = new watchers.StatWatcher(options.bigint); - stat[watchers.kFSStatWatcherStart](filename, - options.persistent, options.interval); + stat[watchers.kFSStatWatcherStart]( + filename, + options.persistent, + options.interval, + ); statWatchers.set(filename, stat); } else { stat[watchers.kFSStatWatcherAddOrCleanRef]('add'); @@ -2570,7 +2594,6 @@ function unwatchFile(filename, listener) { } } - let splitRoot; if (isWindows) { // Regex to find the device root on Windows (e.g. 'c:\\'), including trailing @@ -2607,8 +2630,7 @@ if (isWindows) { const ch = StringPrototypeCharCodeAt(p, i); // Check for a separator character - if (ch === CHAR_BACKWARD_SLASH || ch === CHAR_FORWARD_SLASH) - return i; + if (ch === CHAR_BACKWARD_SLASH || ch === CHAR_FORWARD_SLASH) return i; } return -1; }; @@ -2658,7 +2680,12 @@ function realpathSync(p, options) { // On windows, check that the root exists. On unix there is no need. if (isWindows) { - const out = binding.lstat(base, false, undefined, true /* throwIfNoEntry */); + const out = binding.lstat( + base, + false, + undefined, + true /* throwIfNoEntry */, + ); if (out === undefined) { return; } @@ -2685,8 +2712,7 @@ function realpathSync(p, options) { // Continue if not a symlink, break if a pipe/socket if (knownHard.has(base) || cache?.get(base) === base) { - if (isFileType(statValues, S_IFIFO) || - isFileType(statValues, S_IFSOCK)) { + if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { break; } continue; @@ -2700,7 +2726,12 @@ function realpathSync(p, options) { // Use stats array directly to avoid creating an fs.Stats instance just // for our internal use. - const stats = binding.lstat(base, true, undefined, true /* throwIfNoEntry */); + const stats = binding.lstat( + base, + true, + undefined, + true /* throwIfNoEntry */, + ); if (stats === undefined) { return; } @@ -2742,7 +2773,12 @@ function realpathSync(p, options) { // On windows, check that the root exists. On unix there is no need. if (isWindows && !knownHard.has(base)) { - const out = binding.lstat(base, false, undefined, true /* throwIfNoEntry */); + const out = binding.lstat( + base, + false, + undefined, + true /* throwIfNoEntry */, + ); if (out === undefined) { return; } @@ -2762,10 +2798,7 @@ function realpathSync(p, options) { */ realpathSync.native = (path, options) => { options = getOptions(options); - return binding.realpath( - getValidatedPath(path), - options.encoding, - ); + return binding.realpath(getValidatedPath(path), options.encoding); }; /** @@ -2844,8 +2877,7 @@ function realpath(p, options, callback) { // Continue if not a symlink, break if a pipe/socket if (knownHard.has(base)) { - if (isFileType(statValues, S_IFIFO) || - isFileType(statValues, S_IFSOCK)) { + if (isFileType(statValues, S_IFIFO) || isFileType(statValues, S_IFSOCK)) { return callback(null, encodeRealpathResult(p, options)); } return process.nextTick(LOOP); @@ -3130,7 +3162,6 @@ function globSync(pattern, options) { return new Glob(pattern, options).globSync(); } - module.exports = fs = { appendFile, appendFileSync, @@ -3267,11 +3298,7 @@ module.exports = fs = { _toUnixTimestamp: toUnixTimestamp, }; -defineLazyProperties( - fs, - 'internal/fs/dir', - ['Dir', 'opendir', 'opendirSync'], -); +defineLazyProperties(fs, 'internal/fs/dir', ['Dir', 'opendir', 'opendirSync']); ObjectDefineProperties(fs, { F_OK: { __proto__: null, enumerable: true, value: F_OK || 0 },