is File supported on HTML5 exported?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kakcalu13

in the code where I ran:

var f = File.new() #This is to read each line from the file
if f.file_exists('res://csv_data.csv'):
	f.open(file, File.READ)
	stored_csv = f.get_as_text()

This is the actual example above. It worked perfectly outside of HTML. Some situation that I needed to convert the program into HTML5. So, I converted it and able to work with websocket but I noticed that file doesn’t do anything on html.

Is it supported on HTML5? If so, what do you do to load/read file using html5?

:bust_in_silhouette: Reply From: opyate

On the File docs it says

Note: To access project resources once exported, it is recommended to
use ResourceLoader instead of the File API, as some files are
converted to engine-specific formats and their original source files
might not be present in the exported PCK package.

Here’s an example of how my code changed to work with HTML5:

enter image description here