Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to decode base64 string of any extansion in angular

String[] strings = base64String.split(",");
String extension;
switch (strings[0]) {//check image's extension
    case "data:image/jpeg;base64":
        extension = "jpeg";
        break;
    case "data:image/png;base64":
        extension = "png";
        break;
    default://should write cases for more images types
        extension = "jpg";
        break;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: ex: splide carousel 
Javascript :: impress.js cdn 
Javascript :: useEfefct react 
Javascript :: react router hooks 
Javascript :: javascript variables 
Javascript :: npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. 
Javascript :: Create buffers from strings using the Buffer.from() function. Like toString(), you can pass an encoding argument to Buffer.from(). 
Javascript :: elixir guards 
Javascript :: prevent a function from being called too many times react 
Javascript :: dataset javascript 
Javascript :: javascript eingabe in inputfielder übernehmen 
Javascript :: js round floar 
Javascript :: react native comment in render 
Javascript :: how to strip html tags in javascript 
Javascript :: alpine js x-on click not working 
Javascript :: window.open function 
Javascript :: javascript call and apply methods 
Javascript :: axios delete set content type 
Javascript :: regex exact match 
Javascript :: in compare method why we taking a and b for sorting in javascript 
Javascript :: how to end a javascript program 
Javascript :: react js and graphql integration 
Javascript :: mapStateProps 
Javascript :: Animated Sticky Header 
Javascript :: quasar $t i18n 
Javascript :: react hero slider 
Javascript :: jquery save method 
Javascript :: how to check for null in javascript 
Javascript :: angular lazy loading images 
Javascript :: sweetalert2 small icon 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =