-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Feature request: Buffer.readUint(BE|LE) with BigInt support #21662
Comments
/cc @devsnek |
Ref: #19691 |
i would be more comfortable with another method to give bigints ( |
@devsnek Separate methods for BigInt sound perfectly reasonable. |
Oh man... I was just about to submit a new issue, when I thought I'd do one more search. Coulda got in big trouble 😝 I'll paste it here instead: I see there was an attempt to add these methods a few years ago, but now that we have native All the existing methods should probably be updated to accept BigInts, as it appears presently they do not:
And then some new 64-bit variants would be nice ({read,write}[U]Int64{BE,LE}). I think they'd only take And then lastly, I think Separate methods for the BigInt versions might make more sense, now that you guys mention it. It would create less confusion around why the 64-bit versions don't accept Numbers. |
I've implemented this using N-API: https://github.com/no2chem/bigint-buffer - but I feel that this should be a core part of the node Buffer API (and BigInt API). |
Any news on this feature? |
64-bit int support has arrived. I think we're still missing arbitrary precision support. |
Amazing that JS does support This code (BE) is quite some faster than
|
I believe this was implemented via #19691 and released in Node.js 12.0.0. |
buf.readUIntLE(offset, byteLength)
with byteLength > 6 to returnBigInt
The text was updated successfully, but these errors were encountered: