I am making a mobile app using PhoneGap and I want to convert data base64 string to a file and save it in the mobile device.
How can I convert data base64 string to image file using JavaScript? Is there any JavaScript library that does this?
You may use Data URLs:
<a href="data:jpg/image;base64,/9j/4AAQSkZJR...." target="_blank">
this also works in img-Tags:
<img src="data:jpg/image;base64,/9j/4AAQSkZJR...." />
To trigger this by pure JavaScript, maybe this could work. The back-end should behave like a DOM browser:
var content = "data:jpg/image;base64,/9j/4AAQSkZJR....";
var window = window.open(content, "Image");
window.focus()