Share this page

# IOA.write

Writes the string to the specified file. If the file does not exist, it is created.

    IOA.write(fileName, input, append, charset);

## Arguments

Name | Description
--- | ---
filename | (string) The absolute path of the file.
input | (string) String to write to the file.
appendOptional) | (boolean) Indicates whether to append the string or overwrite the existing file contents: true. Append the string to the end of the file (default). false. Overwrite the file with the string.
charset(Optional) | (string) The charset of the file, if it is not UTF-8. Supported charsets: ['binary', 'UTF-8', 'UTF-16', 'base64', 'ANSI']

## Return value

A promise fulfilled with true upon success.

## Examples

Example 1

Copy code

    IOA.write(TC.scriptDir + "mylog.txt", "first msg\n", false).then(function(result){
      TCA.done(result);
    }).catch(function (error) {
      TCA.doneWithError(error);
    });

Example 2

Copy code

    IOA.write(TC.scriptDir + "mylog.txt", "second msg").then(function(result){
      TCA.done(result);
    }).catch(function (error) {
      TCA.doneWithError(error);
    });

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: