Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript: save base64 string as file

I have a base64 string, file type. File type can be image, text or even pdf. I need to show download link and when user clicks it should start downloading as expected file.
Concisely, server sends me file as base64 string, and I need to save it as file on browser. How can I save base64 string as file on browser? It would be best if solution works on IE9 also.

like image 409
Ikrom Avatar asked Jun 08 '13 05:06

Ikrom


People also ask

How do I get files from Base64?

How to convert Base64 to file. Paste your string in the “Base64” field. Press the “Decode Base64 to File” button. Click on the filename link to download the file.


Video Answer


1 Answers

You can use download.js.

download(base64String, filename, mimeType)
like image 57
kerwal Avatar answered Oct 16 '22 12:10

kerwal