Vérifiez si Base64

// How to check if a string is base64 encoded
// Originally from willnode https://stackoverflow.com/users/3908409/willnode

/* 
Checks if:
 - Length is divisible by 4
 - It uses A-Z, a-z, 0-9, +/=
 - Uses = at the end (within 0-3 characters)
*/

function isBase64(str) {
    return str.length % 4 == 0 && /^[A-Za-z0-9+/]+[=]{0,3}$/.test(str);
}
Banana in Transit