Read File#
This task reads data from a file on OPC UA server using the File Transfer feature. To be used with OPC UA driver in Client mode.
Inputs#
| Name | Data Type | Description |
|---|---|---|
| nodeId | String | The node id where the file will be read. Overrides the File Node Id setting when provided. |
| path | String | Destination file path used when Read Type is ToDirectory. Overrides the Path setting. |
| Activate | any | Activate the task |
Outputs#
| Name | Data Type | Description |
|---|---|---|
| rawData | Buffer | The raw data read from the file. Emitted only when Read Type is ToRaw. |
| 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 |
|---|---|---|---|
| Read Type | Enum | ToRaw | Defines how the file content is delivered: ToRaw emits the content on the rawData output; ToDirectory writes the content to a local file (enables the conditional settings below). |
| File Node Id | String | The node id where the file is (for example, ns=4;s=85.FileTransfer.FileDirectory.FileTest.txt). | |
| 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. |
| Read File Command | String | .Read | Node command syntax to be appended to the File Object node id to identify and invoke the Read File command (for example, .Read, resulting in FileNodeId.Read). Useful to prevent break of compatibilities. |
| Get Position Command | String | .GetPosition | Node command syntax to be appended to the File Object node id to identify and invoke the Get Position command (for example, .GetPosition, resulting in FileNodeId.GetPosition). Useful to prevent break of compatibilities. |
| Delete File Command | String | .Delete | Node command syntax to be appended to the File Object node id to identify and invoke the Delete File command (for example, .Delete, resulting in FileNodeId.Delete). Useful to prevent break of compatibilities. |
| File Chunk Size | String | 0 | Configured size for the file chunks. If no value or a zero is provided, the chunks will default to the maximum allowed on the protocol (16000000 Bytes). |
| File Size Syntax | String | .Size | Node syntax to get the Size attribute, for instance, SomeFileIdentification.Size. Useful to prevent break of compatibilities. |
| Automatically Delete File | Boolean | false | Flag to indicate if the file shall be deleted after a successful read operation. |
| Directory Node ID | String | The node id of the directory object where the file is located. Necessary for the Delete command (can only be called from the directory object level). |
When Read Type is set to ToDirectory, the following additional settings become available:
| Name | Data Type | Default | Description |
|---|---|---|---|
| Path | String | Full path of the file to create. Mandatory. Supports tokens such as ${path}, ${archive}, ${temp}, ${id} (e.g., ${temp}\files\${id}\Recipe\File.csv). | |
| Encoding | Enum | utf8 | Encoding of the file content. Allowed values: utf8, ucs2, utf16le, latin1, binary, base64, ascii, hex. |
| Mode | Integer | 438 | File permissions in Linux integer format (e.g., 0o666 = 438, 0o777 = 511, 0o655 = 429). |
| Flag | String | w | Flag used when writing to the file. Common options: w (write, create/truncate), w+ (read+write, create/truncate), a (append, create), a+ (read+append, create). See https://nodejs.org/api/fs.html#fs_file_system_flags. |
| Number of attempts | Integer | 1 | Number of attempts to perform the operation before reporting a failure. |
| Sleep between attempts | Integer | 1000 | Amount of time (in milliseconds) to wait between attempts so that conditions can become more favorable for a success. |
Behavior#
Activate will trigger a message to the driver. The contents of the message are the values received in the inputs.
Remarks#
- All the communication with the equipment is handled by the driver in the backend.

