1

I'm writing a downloader chrome extension. I'm trying to fetch the file with ajax and encode it with atob(str) but it only allows plain strings so can't get data:blah,base64 working.

user1528601
  • 43
  • 1
  • 4

1 Answers1

0

You want to make an AJAX call to a binary file and get data:xxx/xxx;base64,xxx= in return? This is not going to happen unless the file is returned by the server using Data URI scheme. You need to use xhr.responseBlob().

Similar question was asked before, and the answer there should help you. You can also check out this example.

Community
  • 1
  • 1
Konrad Dzwinel
  • 36,825
  • 12
  • 98
  • 105