Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node/fs): enable to check error thrown on invalid values of bufferSize #2782

Merged
merged 6 commits into from
Oct 22, 2022

Conversation

wafuwafu13
Copy link
Contributor

part of: #911

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM with a small comment.

Comment on lines 84 to 89
if (options) {
({ encoding = "utf8", bufferSize = 32 } = options);
} else {
encoding = "utf8";
bufferSize = 32;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Node uses a utility function called getOptions() here. We have that here (although the second argument should be updated to default to kEmptyObject). I think it would be preferable to use that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • use getOptions()
  • use validateInteger instead of checkBufferSize
  • delete assertEncoding because called in getOptions()

@wafuwafu13 wafuwafu13 marked this pull request as draft October 18, 2022 13:48
@wafuwafu13 wafuwafu13 requested review from cjihrig and removed request for kt3k and bartlomieju October 20, 2022 13:33
@wafuwafu13 wafuwafu13 marked this pull request as ready for review October 20, 2022 13:33
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM with a small nit.

assertEncoding(encoding);

checkBufferSize(bufferSize, "options.bufferSize");
const { _encoding, bufferSize } = getOptions(options, {
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to destructure _encoding out if it's not being used. Same comment below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed fe69a42

@wafuwafu13 wafuwafu13 requested a review from cjihrig October 22, 2022 13:05
@cjihrig cjihrig merged commit 9edf3df into denoland:main Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants