-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support all TypedArray primitives #8
Comments
Thank you for the suggestion! It does seem to be a rather general feature, enough to be included in the library. I will start work on it asap, apologies for the late response 💜 |
I am currently wondering about one thing. Lets say we have the following code: import { object, string, u8array } from 'typed-binary';
const Packet = object({
label: string,
data: u8Array(64),
});
const buffer = /* getting the data from somewhere */;
const reader = new BufferReader(buffer);
// type of packet inferred as { label: string, data: Uint8Array }
const packet = Packet.read(reader);
packet.data[0] = 'B'; // does this mutate `buffer`, or not? Basically the question is, is |
I also think it should make a safe copy of the buffer so mutating it would not affect the original buffer. |
@mkapal The implementation and docs should be ready for a review, would love if you could take a look at it before merging 💚 |
I'm happy to have found this library, it looks very promising!
One thing I'm missing is support for converting all primitives from the TypedArray group - that is all signed/unsigned integers, 16-bit integers and BigInts.
Do you plan to add those in the near future? Or I could try to do it myself and create a PR.
The text was updated successfully, but these errors were encountered: