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

add missing constants #312

Merged
merged 2 commits into from
Oct 8, 2023
Merged

add missing constants #312

merged 2 commits into from
Oct 8, 2023

Conversation

urg
Copy link
Contributor

@urg urg commented Apr 26, 2022

add missing kStringMaxLength, constants.MAX_LENGTH & constants.MAX_STRING_LENGTH

fixes #311

Copy link
Collaborator

@dcousens dcousens left a comment

Choose a reason for hiding this comment

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

LGTM, but I want a reference for that 2**28 - 1 value.
Reading https://nodejs.org/docs/latest/api/buffer.html#bufferconstantsmax_length , the value seems to be about 2**30-1 on 32-bit architectures.

I think any buffer actually near these magnitudes will probably fail no matter, but, if we have a value, it should have a reference.

@urg urg requested a review from dcousens October 8, 2023 08:34
@urg
Copy link
Contributor Author

urg commented Oct 8, 2023

@dcousens - good point on the reference. I can't find where I got the initial value from, however, its now set to what it is in the current version of node.

Please note this is for the max string length and not the max buffer length (https://nodejs.org/docs/latest/api/buffer.html#bufferconstantsmax_string_length). Max buffer length was already defined and just exported to match api spec.

@dcousens
Copy link
Collaborator

dcousens commented Oct 8, 2023

Thanks for the fast follow up @urg, LGTM! 💙

@dcousens
Copy link
Collaborator

dcousens commented Oct 8, 2023

The tests are passing, the CI has other issues (see #332, I'll be resolving this before the next release).

@dcousens dcousens merged commit 7ca8fc5 into feross:master Oct 8, 2023
1 of 5 checks passed
@jeremymeng
Copy link

Looks that the typing file hasn't been upgraded to include the newly added constants.

@dcousens
Copy link
Collaborator

@jeremymeng I have this on my TODO, but I don't have an ETA for you

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.

Missing buffer.constants.*
3 participants