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

Replace Buffer with Uint8Array #72

Open
letmaik opened this issue Oct 15, 2021 · 4 comments
Open

Replace Buffer with Uint8Array #72

letmaik opened this issue Oct 15, 2021 · 4 comments

Comments

@letmaik
Copy link

letmaik commented Oct 15, 2021

Currently, this library cannot directly be used in non-Node environments (without Buffer polyfills). Are there any issues with switching to ArrayBuffer instead? Just wondering if such a contribution would be accepted.

@silverwind
Copy link
Collaborator

silverwind commented Nov 10, 2023

I think UInt8Array is the preferred Buffer replacement, see this. I would accept such a refactor.

@silverwind silverwind changed the title Use ArrayBuffer to avoid Node dependency Replace Buffer with Uint8Array Nov 10, 2023
@frankhinek
Copy link

@silverwind @mafintosh It seems like a fair bit of work was put into this fork: https://github.com/dnsquery/dns-packet
to switch to Uint8Array and add types.

What are the views of current maintainers for this approach? Is the preference to solely swap Buffer for Uint8Array or would a TypeScript refactor also be accepted?

@silverwind
Copy link
Collaborator

UInt8Array will be a breaking change, so I guess it might make sense to bundle a switch to TS with it. I'm not much of a TS aficionado, but I guess I should manage to review if you keep it simple.

@mafintosh
Copy link
Owner

you can switch it to use holepunchto/b4a, we use that for easy browser compat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants