Skip to content

Commit 17a48f1

Browse files
cjihrigtargos
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 cb75f56 commit 17a48f1

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
@@ -899,15 +899,15 @@ function stat(path, options = { bigint: false }, callback) {
899899
binding.stat(pathModule.toNamespacedPath(path), options.bigint, req);
900900
}
901901

902-
function fstatSync(fd, options = {}) {
902+
function fstatSync(fd, options = { bigint: false }) {
903903
validateInt32(fd, 'fd', 0);
904904
const ctx = { fd };
905905
const stats = binding.fstat(fd, options.bigint, undefined, ctx);
906906
handleErrorFromBinding(ctx);
907907
return getStatsFromBinding(stats);
908908
}
909909

910-
function lstatSync(path, options = {}) {
910+
function lstatSync(path, options = { bigint: false }) {
911911
path = getValidatedPath(path);
912912
const ctx = { path };
913913
const stats = binding.lstat(pathModule.toNamespacedPath(path),
@@ -916,7 +916,7 @@ function lstatSync(path, options = {}) {
916916
return getStatsFromBinding(stats);
917917
}
918918

919-
function statSync(path, options = {}) {
919+
function statSync(path, options = { bigint: false }) {
920920
path = getValidatedPath(path);
921921
const ctx = { path };
922922
const stats = binding.stat(pathModule.toNamespacedPath(path),

0 commit comments

Comments
 (0)