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 base64 encoded string #46

Open
Drakes-0 opened this issue May 14, 2019 · 1 comment
Open

Decode base64 encoded string #46

Drakes-0 opened this issue May 14, 2019 · 1 comment

Comments

@Drakes-0
Copy link

I don't want to install another library to decode base64 encoded string, so should I use this lib in strange way like this ?
base64url.decode(base64url.fromBase64(string))

@mvasilkov
Copy link

mvasilkov commented May 29, 2019

You don't need a library for that.

Buffer.from(b64string, 'base64') // decode to a Buffer
Buffer.from(b64string, 'base64').toString('utf-8') // decode to a string

For browser JS, see https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding

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

2 participants