FileReader() in JS Transformer

Does JS Transformer support using FileReader() function to read HTML file? Or there is an alternative to instead of using FileReader()?

What I want to achieve is basically when user input HTML file, the content (the code) inside that file will be expected as output in a textarea input.

Hey @yeftanma!

How would users be inputting HTML files in your app? If you're using a file input or similar component you may be able to do something like {{ atob(fileInput1.value[0]) }} to render the HTML in a text file.

It's possible to use the FileReader API but Retool file inputs store files as base64 strings instead of Blobs. You can get around that using a workaround like this or by using a script in a component in which you can create your own upload component. Both solutions might add some unnecessary complexity though :thinking:

Let me know if something like the attached app works for you! (You can import and play around with it)
render_html_file.json