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

Add Support for ArrayBuffer and the various TypedArrays #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LorisSigrist
Copy link

This is something that tripped me up a couple times, and given that #26 is three years old, I'm likely not the only one.

This PR adds support for ArrayBuffer and the various Typed Arrays (Uint8Array etc). It serialises them by encoding the underlying ArrayBuffer in base64.

I chose not to do the pointer-value style encoding that arrays use for the following reasons:

  • ArrayBuffers are never hole-y, so the potential savings are lesser
  • ArrayBuffers often represent images and likely have highly varied values. Pointer-value would likely be longer.

Since atob and btoa are not included in the project's ts libs I used JS implementations of both. I didn't want to introduce additional libs without consulting first.

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

Successfully merging this pull request may close these issues.

None yet

1 participant