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:
|
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
IOA.write(TC.scriptDir + "mylog.txt", "first msg\n", false).then(function(result){
TCA.done(result);
}).catch(function (error) {
TCA.doneWithError(error);
});
Example 2
IOA.write(TC.scriptDir + "mylog.txt", "second msg").then(function(result){
TCA.done(result);
}).catch(function (error) {
TCA.doneWithError(error);
});