I have a base64 of a .txt file and I want to display it in React. The file looks like this:
ID:948201
name:"someText"
description:".txt"
base64File:"QU5URSBQVVBBQ0lDIEtSQUFBQUFBQUFBQUFMSg=="
Can I display the text of the document, which is "ANTE PUPACIC KRAAAAAAAAAAALJ", somehow on the browser?
3
Answers
I have no idea in which format you may want to convert your file, I hope following link may help you :
https://forums.meteor.com/t/base64-convert-back-to-file/34188
Yes, you can turn the base64 to a
File
and then useFileReader
API to read theFile
as a text.References.
Turn base64 to file
Use FileReader API to read the file text.
you can decode base64 using
atob()
: