Method to read the contents of a file. The method returns the content of the file. Line feeds are preserved. You can also use the method .content().
Note: This method is different from the default ExtendScript method read()
.
var file = new File("C:/myfile.txt"); var filecontents = file.readFile();
Parameter | Data type | Required | Description |
---|---|---|---|
encoding | string | The file encoding used for reading the file. Default encoding is UTF-8 |
Value | Meaning |
---|---|
null | The file does not exist |
string | The contents of the file |