-
Notifications
You must be signed in to change notification settings - Fork 638
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
Conversation
There was a problem hiding this 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.
node/_fs/_fs_opendir.ts
Outdated
if (options) { | ||
({ encoding = "utf8", bufferSize = 32 } = options); | ||
} else { | ||
encoding = "utf8"; | ||
bufferSize = 32; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ofcheckBufferSize
- delete
assertEncoding
because called ingetOptions()
There was a problem hiding this 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.
node/_fs/_fs_opendir.ts
Outdated
assertEncoding(encoding); | ||
|
||
checkBufferSize(bufferSize, "options.bufferSize"); | ||
const { _encoding, bufferSize } = getOptions(options, { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed fe69a42
part of: #911