I have generated a string of a file using this:
const reader = new window.FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
var x = reader.result.toString();
console.log("File String :: ", x);
};
How to convert this string to actual file like if the previous file was a PDF then this string will converted to a pdf file
reader.result.toString() gives me a string like this "data:application/pdf;base64,JVBERi0xLjQKJSDi48/..........."
I want to convert it back to pdf
FileReader.readAsDataURL()
readAsDataURLreferences that the result of the method will be the contents of the file in base64. So it appears what you are asking is how to convert back from base64.data:application/pdf;base64,JVBERi0xLjQKJSDi48/...........I want to convert it back to pdf