User Tools

Site Tools




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

Return Values

Value Meaning
null The file does not exist
string The contents of the file
file/readfile.txt · Last modified: 2017/05/20 14:39 (external edit)