Skip to content

Instantly share code, notes, and snippets.

@jeevan-vj
Forked from RyanNutt/isBase64.js
Created February 20, 2018 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeevan-vj/ae811d91b6751d20b8c2480d44612430 to your computer and use it in GitHub Desktop.
Save jeevan-vj/ae811d91b6751d20b8c2480d44612430 to your computer and use it in GitHub Desktop.
Check if a String is base64 encoded using JavaScript - from https://stackoverflow.com/a/34068497/1561431
function isBase64(str) {
try {
return btoa(atob(str)) == str;
} catch (err) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment