1toDataURL('/images/Negativo_Leve.svg', function(dataUrl) {
2 console.log('RESULT:', dataUrl)
3});
4
5function toDataURL(url, callback) {
6 var xhr = new XMLHttpRequest();
7 xhr.onload = function() {
8 var reader = new FileReader();
9 reader.onloadend = function() {
10 callback(reader.result);
11 }
12 reader.readAsDataURL(xhr.response);
13 };
14 xhr.open('GET', url);
15 xhr.responseType = 'blob';
16 xhr.send();
17}