Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ function readdirSync(path, options) {
return options.withFileTypes ? getDirents(path, result) : result;
}

function fstat(fd, options, callback) {
function fstat(fd, options = { bigint: false }, callback) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just options = {}? (Same below.)

Copy link
Copy Markdown
Contributor Author

@UziTech UziTech Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied fs/promises.js

async function fstat(handle, options = { bigint: false }) {

Should I use getOptions(options, {bigint: false}) to match the other functions?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getOptions() does a bunch of other things that do not fit these APIs (like accepting a string as the encoding option), using default arguments should be fine considering we do this for many other APIs as well.

if (typeof options === 'function') {
callback = options;
options = {};
Expand All @@ -807,7 +807,7 @@ function fstat(fd, options, callback) {
binding.fstat(fd, options.bigint, req);
}

function lstat(path, options, callback) {
function lstat(path, options = { bigint: false }, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
Expand All @@ -819,7 +819,7 @@ function lstat(path, options, callback) {
binding.lstat(pathModule.toNamespacedPath(path), options.bigint, req);
}

function stat(path, options, callback) {
function stat(path, options = { bigint: false }, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
Expand Down