fs: use consistent defaults in sync stat functions
This commit updates the default options used by statSync(), lstatSync(), and fstatSync() to be identical to the defaults used by the callback- and Promise-based versions. PR-URL: https://github.com/nodejs/node/pull/31097 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
cbcee2d260
commit
3cd77805fe
@ -922,7 +922,7 @@ function stat(path, options = { bigint: false }, callback) {
|
||||
binding.stat(pathModule.toNamespacedPath(path), options.bigint, req);
|
||||
}
|
||||
|
||||
function fstatSync(fd, options = {}) {
|
||||
function fstatSync(fd, options = { bigint: false }) {
|
||||
validateInt32(fd, 'fd', 0);
|
||||
const ctx = { fd };
|
||||
const stats = binding.fstat(fd, options.bigint, undefined, ctx);
|
||||
@ -930,7 +930,7 @@ function fstatSync(fd, options = {}) {
|
||||
return getStatsFromBinding(stats);
|
||||
}
|
||||
|
||||
function lstatSync(path, options = {}) {
|
||||
function lstatSync(path, options = { bigint: false }) {
|
||||
path = getValidatedPath(path);
|
||||
const ctx = { path };
|
||||
const stats = binding.lstat(pathModule.toNamespacedPath(path),
|
||||
@ -939,7 +939,7 @@ function lstatSync(path, options = {}) {
|
||||
return getStatsFromBinding(stats);
|
||||
}
|
||||
|
||||
function statSync(path, options = {}) {
|
||||
function statSync(path, options = { bigint: false }) {
|
||||
path = getValidatedPath(path);
|
||||
const ctx = { path };
|
||||
const stats = binding.stat(pathModule.toNamespacedPath(path),
|
||||
|
Loading…
x
Reference in New Issue
Block a user