ArrayBuffer/DataView compatibility?
Opened this issue · 2 comments
natevw commented
If we migrated off Buffer to ArrayBuffer, then struct-fu
would work natively in the browser too.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView for methods there.
natevw commented
May be easier to keep backwards-compatiblity with Buffer than I'd worried. See https://nodejs.org/api/buffer.html#buffer_buffers_and_typedarray:
Buffer instances are also Uint8Array instances. However, there are subtle incompatibilities with the TypedArray specification in ECMAScript 2015. […]
I wonder if performance hit of checking/wrapping within all the nested sub-fields is going to be a problem, though?
natevw commented
For strings we'd also need TextEncoder — and it looks like that only supports UTF-8 anymore.