Method to read and write files. This method is a shorthand method for both .readFile() and .writeFile().
The method .content() is located in the file file.jsxinc.
Usage
To get the contents of a file:
var file = new File("C:/myfile.txt");
var filecontents = file.content();To write a string to a file:
var content = "String to insert into file";
var file = new File("C:/myfile.txt");
var contents = file.content(content);Parameters
When parameters are omitted, this method gets the content of the file.
| Parameter | Data type | Required | Description |
|---|---|---|---|
| content | String | The string to write to the file. | |
| encoding | String | The encoding to write the file. When not specified the default encoding UTF-8 is used. |
Return values
| Value | Meaning |
|---|---|
| null | The file does not exist. No content can be returned. |
| string | The contents of the file. |
| true | The specified contents was written to the file. |
