Skip to content

Commit 4f32bbb

Browse files
cjihrigBridgeAR
authored andcommitted
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: #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>
1 parent 1fa8e49 commit 4f32bbb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/fs.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -922,15 +922,15 @@ function stat(path, options = { bigint: false }, callback) {
922922
binding.stat(pathModule.toNamespacedPath(path), options.bigint, req);
923923
}
924924

925-
function fstatSync(fd, options = {}) {
925+
function fstatSync(fd, options = { bigint: false }) {
926926
validateInt32(fd, 'fd', 0);
927927
const ctx = { fd };
928928
const stats = binding.fstat(fd, options.bigint, undefined, ctx);
929929
handleErrorFromBinding(ctx);
930930
return getStatsFromBinding(stats);
931931
}
932932

933-
function lstatSync(path, options = {}) {
933+
function lstatSync(path, options = { bigint: false }) {
934934
path = getValidatedPath(path);
935935
const ctx = { path };
936936
const stats = binding.lstat(pathModule.toNamespacedPath(path),
@@ -939,7 +939,7 @@ function lstatSync(path, options = {}) {
939939
return getStatsFromBinding(stats);
940940
}
941941

942-
function statSync(path, options = {}) {
942+
function statSync(path, options = { bigint: false }) {
943943
path = getValidatedPath(path);
944944
const ctx = { path };
945945
const stats = binding.stat(pathModule.toNamespacedPath(path),

0 commit comments

Comments
 (0)