User Tools

Site Tools




Method to read and write files. This method is a shorthand method for both the functions readFile() and writeFile(). This method is the equivalent of the function file_content().


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 replace file content with";
var file = new File("C:/myfile.txt");
var contents = file.content(content);

Note: This function will replace all content in the file. Use the ExtendScript default file manipulation for more granular options.


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
string The contents of the file
true The specified contents was written to the file
file/content.txt · Last modified: 2017/05/25 10:16 (external edit)