JSFiddle - React, Tailwind, and code Playground
by Michael Prosser
JavaScript
var toDataURL = function(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function() {
callback(reader.result);
}
reader.readAsDataURL(xhr.response);
};
xhr.open('GET', url);
xhr.responseType = 'blob';
xhr.send();
}
toDataURL('https://aninoob.com/constellations/account/images/dreamland.png',function(result){
console.log(result);
})