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

feat(buffer): add some new function bindings. #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

muqiuhan
Copy link
Contributor

  • readBig(U)Int64(BE/LE)
  • subarray(ToEnd)

NOTE: Buffer.slice is now deprecated (since node 16.x LTS)

Refs.

- readBig(U)Int64(BE/LE)
- subarray(ToEnd)

NOTE: Buffer.slice is now deprecated (since node 16.x LTS)

Refs.
=======

- https://nodejs.org/docs/latest-v16.x/api/buffer.html#bufslicestart-end
@@ -272,9 +272,24 @@ external readUintBE: (t, ~offset: int, ~length: int) => float = "readUintBE"
@send
external readUintLE: (t, ~offset: int, ~length: int) => float = "readUintLE"

@send
external readBigInt64BE: (t, ~offset: int) => bigint = "readBigInt64BE"
Copy link
Contributor Author

@muqiuhan muqiuhan Jan 19, 2025

Choose a reason for hiding this comment

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

CI says there are compilation errors here:

   We've found a bug for you!
  /home/runner/work/rescript-nodejs/rescript-nodejs/src/Buffer.res:276:47-52

  274275 │ @send
  276external readBigInt64BE: (t, ~offset: int) => bigint = "readBigInt64BE
      │ "
  277278 │ @send

  This type constructor, `bigint`, can't be found.
  If you wanted to write a recursive type, don't forget the `rec` in `type rec`

But rescript 11.1 already treats bigint as primitive type: Primitive Types | Big Integer.


Maybe it's because the rescript version in the devDependencies of the current project is 11.0.1:

  "devDependencies": {
    "rescript": "^11.0.1",
  },

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, this repo is quite out of date, feel free to upgrade.

@TheSpyder
Copy link
Owner

NOTE: Buffer.slice is now deprecated (since node 16.x LTS)

Feel free to add an @deprecated warning while you're here 🙂

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