How to read a file from path



I’m trying read a file from a path using the File class but is not working:

this.file = new File([this.path], false)

\\return File Object
\\return Uncaught TypeError: is not a function

I tried with other functions like isFile(), write(), exists(), but all return same error. When instantiating a File object in dev console, on autocomplete, appear only this functions options:

What the right way to read a file content from some path?


If the File API isn’t working for you, you could try Node’s fs module.