I am writing a Figma plugin that uses JavaScript and I need to open a file from the plugin folder. This is not JS on a webpage. I mention that because all the JS examples I can find assume a <input type='file'/>
.
The code should look something like this:
function readFile (file: File)
{
let reader = new FileReader() ;
reader.onload = () =>
{
console.log(reader.result) ;
}
reader.readAsText(file) ;
}
readFile(new File("folder/File.xml")) ;