Base64 String From an Image on Your Computer and From a URL Link

Published: 18 December 2022
on channel: ZeroLife
291
0

HTML (File Picker)
================
❮input type="file" onchange="stringBase64File(this)" /❯

JAVASCRIPT (From File Picker)
=============================
function stringBase64File(elem){
let file = elem.files[0];
let reader = new FileReader();
reader.onloadend = function() {
log.console(reader.result)
}
reader?.readAsDataURL(file);
};


JAVASCRIPT (From URL)
================================
async function getBase64FromUrl(url){
const data = await fetch(url);
const blob = await data.blob();
return new Promise((resolve) =❯ {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () =❯ {
const base64data = reader.result;
resolve(console.log(base64data));
}
});
};


DONATE:
---------------
PAT:   / rezatahirkheli  
PP: https://www.paypal.com/paypalme/rezat...
BTC: 3EUQBWZKX9Vcwdffd3cUGATQopxrAQQxJ9
LTC: MBXE6hJgxxFYSD8SjmR7sHCHGTqFXmNGoU


Watch video Base64 String From an Image on Your Computer and From a URL Link online without registration, duration hours minute second in high quality. This video was added by user ZeroLife 18 December 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 291 once and liked it 0 people.