From 465a1cf8b9029ed46b28d7eeadb2a1c459ba4a13 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 25 Dec 2019 21:36:33 -0500 Subject: [PATCH] fs: use consistent defaults in sync stat functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/fs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index b20b18283affe8..1420e60daaf2f5 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -899,7 +899,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); @@ -907,7 +907,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), @@ -916,7 +916,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),