Open uiovasot opened 2 months ago
Yeah I absolutely agree. 👍 I've had this on my todo list for a while actually, just haven't found time for it.
However I think I'd prefer ArrayBuffer, not Uint8Array, since it feels like a slightly more correct level of abstraction for this package. Let me know if you disagree. (And of course, using a DataView internally to read/write values.)
I'll try and set aside some time soon to do this.
Thank you :) I will try it too I'm working on this here: https://github.com/uiovasot/easy-buffer/tree/dev
I would like to propose that we change Buffer to Uint8Array in this library.
The current library utilizes the Buffer class from Node.js. When Node.js first came out, Uint8Array didn't exist, so we had to create a Buffer. However, Buffer is now outdated. Now, Buffer is an instance of Uint8Array, but Buffer is not supported in browsers and never will be. Furthermore, Buffer exposes information in global variables, which can cause potential security issues.
Now we can use Uint8Array, a general-purpose byte array that can be used consistently across servers and browsers.
By switching to Uint8Array, this library gains the following benefits:
Implementing this change may require some changes, as there are subtle incompatibilities between Uint8Array and Buffer.
I believe this proposal will benefit current library and users, and welcome any feedback on this topic.