javascript - Generate Base64 String with local url of image without input type file -


i trying generate base64 string of local url of image. searched lot didn't got answer. found many example convert base64 string http url of image have local url of image. tried create file object not working. here example tried:

convertfiletodataurlviafilereader(url){     var file = new file([""],url, {type: "image/jpeg"});     let reader = new filereader();     reader.onload = (event) => {         var base64 = event.target.result;         return base64;     };     reader.readasdataurl(file);      } 

here url absolute path of image : file:\\c:\users\abc\pictures\butterfly.jpg example not generating base64 image ie returning blank string :

output

data:/ 


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -