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

Decode allow re-using a pre-allocated buffer? #15

Open
jeffvandyke opened this issue Jun 25, 2019 · 0 comments
Open

Decode allow re-using a pre-allocated buffer? #15

jeffvandyke opened this issue Jun 25, 2019 · 0 comments

Comments

@jeffvandyke
Copy link

For repeated invocations with temporary data, there's an opportunity (not sure how great) for memory allocation savings if instead of always creating a new ArrayBuffer, the decode function allows an optional 2nd parameter for a reusable ArrayBuffer that is console.assert()'ed to be at least the length needed for decoding the base64 string.

Perhaps the decode function could return the number of bytes written instead of an ArrayBuffer if a buffer is provided - speculating usefulness for handling variable-byte input strings.

Would you be open to a PR for this?

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