Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js check if string is base64

function isBase64(str) {
    if (str ==='' || str.trim() ===''){ return false; }
    try {
        return btoa(atob(str)) == str;
    } catch (err) {
        return false;
    }
}
Comment

how to check if a string is correctly encoded as base64 in javascript

function isBase64(str) {
    if (str ==='' || str.trim() ===''){ return false; }
    try {
        return btoa(atob(str)) == str;
    } catch (err) {
        return false;
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: add class tr datatable 
Javascript :: regex for lowercase letters js 
Javascript :: corresponding text to key code js 
Javascript :: node open file 
Javascript :: jquery on click 
Javascript :: orthographic camera three js 
Javascript :: set value to element paragraph in javascript 
Javascript :: express draft 
Javascript :: this.$router.push nuxt 
Javascript :: jquery disable form element 
Javascript :: textbox text change jquery 
Javascript :: node crypto hmac sha256 
Javascript :: longest substring without repeating characters in javascript 
Javascript :: iframe in angular 
Javascript :: dm someone by id discord.js 
Javascript :: capital first letter react 
Javascript :: how to clean react native project 
Javascript :: discord.js send text in different channel on server 
Javascript :: js add css class to element 
Javascript :: react-native curved view 
Javascript :: backbone events 
Javascript :: jquery event source 
Javascript :: iterate array javascript 
Javascript :: make link disabled in angular 
Javascript :: vscode prettier use tabs 
Javascript :: javascript redirect to a page 
Javascript :: change word in string javascript 
Javascript :: update data firebase firestore javascript 
Javascript :: set delay javascript 
Javascript :: react beforeunload 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =