saveToFile
Saves data to a file. This function is typically used to save a byte array, string, or XML document to a file.
Syntax
ogscript.saveToFile(path, data, overwrite);
Parameters
Parameter |
Type |
Required |
Description |
path |
String |
Yes |
The directory path to the destination file. |
data |
String, byte[], or XML |
Yes |
The data to be saved to file. |
overwrite |
Boolean |
Yes |
When true, existing file of the same name is overwritten. When false, existing file of the same name is not overwritten. |
Returns
Returns true, if data is written successfully; otherwise false.
Example
ogscript.saveToFile('files/my-new-file.txt','This is my data',true);