Skip to content

Commit

Permalink
fs: use consistent defaults in sync stat functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
cjihrig authored and BridgeAR committed Jan 3, 2020
1 parent 1fa8e49 commit 4f32bbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,15 @@ 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);
handleErrorFromBinding(ctx);
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),
Expand All @@ -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),
Expand Down

0 comments on commit 4f32bbb

Please sign in to comment.