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

feature request: as_base64() #4

Closed
TheCGDF opened this issue Mar 6, 2020 · 2 comments
Closed

feature request: as_base64() #4

TheCGDF opened this issue Mar 6, 2020 · 2 comments

Comments

@TheCGDF
Copy link

TheCGDF commented Mar 6, 2020

encode binary data with base64 so that the data can be contained in JSON easily.
i think it is useful.

@dessalines
Copy link

I'd just use the base64 crate for this, I did this and its a one liner:

    let png_byte_array = captcha.as_png().expect("failed to generate captcha");
    let png = base64::encode(png_byte_array);

@daniel-e
Copy link
Owner

I justed added a method as_base64() which returns the a png encoded as base64. @TheCGDF thank you for your feature request and @dessalines thank you for your example.

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

3 participants