--- alias: user-guide-automation-task-opcua-writefile tags: - automation tasks description: "This task writes data to a file on an OPC UA server" --- # Write File :iot-commandresult-lg:{style="font-size: 100px"} This task write data to a file in OPC UA server using the File Transfer feature. To be used with OPC UA driver in Client mode. ![Screenshot showing a file writing operation with filename input field.](./images/write_file_parameters.png) ## Inputs | Name | Data Type | Description | | -------- | ---------| ------------------------------------------ | | nodeId | `String` | The node id where the file will be written | | rawData | `Buffer` | The raw data to be written in the file | | Activate | `any` | Activate the task | ## Outputs | Name | Data Type | Description | | ------ | --------- | ------------------------------------------------------ | | Success | `Boolean` | If there was no problem emits a true | | Error | `Error` | Error that occurred during the processing of this task | ## Settings On the *General Tab*, you have the usual settings and the following settings: | Name | Data Type | Default | Description | | ------------------ | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Data Chunk Size | `Number` | 0 | If the value is 0, splitting the data buffer into chunks is disabled. Otherwise, the received buffer size will be divided by this value, creating several data chunks. | | Open File Command | `String` | .Open | Node command syntax to be appended to the File Object node id to identify and invoke the Open File command (for example, `.Open`, resulting in `FileNodeId.Open`). Useful to prevent break of compatibilities. | | Close File Command | `String` | .Close | Node command syntax to be appended to the File Object node id to identify and invoke the Close File command (for example, `.Close`, resulting in `FileNodeId.Close`). Useful to prevent break of compatibilities. | | Write File Command | `String` | .Write | Node command syntax to be appended to the File Object node id to identify and invoke the Write File command (for example, `.Write`, resulting in `FileNodeId.Write`). Useful to prevent break of compatibilities. | ![Screenshot showing the "Write File" settings.](./images/write_file_settings.png) ## Behavior Activate will trigger a message to the driver. The contents of the message are the values received in the inputs and settings. ## Remarks * All the communication with the equipment is handled by the driver in the backend. * The existing content of the file is erased and the new data will be saved.