Function to read the contents of a file. The function returns the content of the file. Line feeds are preserved. This function is the equivalent of the method .readFile().
var file = new File("C:/myfile.txt"); var filecontents = readFile(file);
Parameter | Data type | Required | Description |
---|---|---|---|
file | file object | True | The file to read the content from |
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 |