fileWrite
The fileWrite operation writes the specified data to the file at the specified URI.
Required Parameters
The input item for the fileWrite operation must set the following parameters:
- file: the URI pointing to the file that you want to write data to. If this file does not exist, the component creates it when executing this operation.
- data: the data that you want to write to the specified file.
Optional Parameters
The input item for the fileWrite operation can optionally set the following parameters:
- force: when this parameter is set to true, if one or more of the folders in the path specified in the "file" parameter do not exist, the component creates those missing directories. The allowed values are true and false. If this parameter is set to false and folders in the specified directory are missing, the component does not perform the write operation and returns an error. The default is true.
- mode: specifies whether to truncate (overwrite the existing data in the file with the new data) or append (add the new data onto the end of the existing data in the file) when executing this operation. The default behavior is to truncate.
- encoding: the encoding to use when creating a new file. The allowed values are determined by your JVM/OS. The default is UTF-8.
Output Parameters
The output items returned by the fileWrite operation have the following parameters:
- file: the full path of the file that was written to.
- cdate: the modified date of the file that was written to.
Example
The following example adds the message "This is a sample value." to the file "new.txt".
<rsb:set item=inputitem attr=file value="C:/Users/Publish/new.txt"/> <rsb:set item=inputitem attr=data value="This is a sample value."/> <rsb:call op="fileWrite" in=inputitem out=outitem/>