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

A more efficient way of encoding binary data as strings in localStorage #1087

Open
f478ccf2 opened this issue May 10, 2023 · 0 comments
Open

Comments

@f478ccf2
Copy link

f478ccf2 commented May 10, 2023

I think I've found a more efficient way of encoding binary data as strings, with 0% overhead (this might have been brought up before):
Iterate over every byte of the binary data and append String.fromCharCode(byte) to the output string. The resulting string can be stored in localStorage, and when reversed (with .charCodeAt) returns the original binary data fully intact (from 0-255).

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

No branches or pull requests

1 participant