mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets
MIT License
207 stars 71 forks source link

Replace `Buffer` with `Uint8Array` #72

Open letmaik opened 3 years ago

letmaik commented 3 years ago

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 commented 1 year ago

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

frankhinek commented 10 months ago

@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 commented 10 months ago

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 commented 10 months ago

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