File: Write Node

The File: Write Node allows you to write to a file on your Edge Compute device. This node is only available in edge workflows.

File Write Node

Configuration

There are a number of configuration options for this node:

  • File Path: (Required) A string template for the disk location of where to write the file.
  • Encoding: The content encoding (defaults to UTF8).
  • File Content: (Required) A string template for the content to write to the file.
  • Result Path: A payload path for where to store the result of the operation, if desired.

File Write Node Configuration

If a file does not already exist at the file path defined in your configuration, the node will write a new file to disk at that path.

There are three options for what to do if a file does exist at the specified file path:

  1. Cancel and return an error if the file exists: This will only write to a file that is nonexistent to avoid overwriting the wrong file.
  2. Append my content to the file if it exists: This will cause the content to be appended at the end of the file, so all the content currently in the file will stay, the node will simply add to the content.
  3. Overwrite the file with my new content if it exists: (Default) This allows you to completely replace the file with the content from the node.

Result

The result path is optional; if it is set, the result of the write operation will be placed at the payload path specified.

For example, If the result path is set to data.result, and the write was successful, the result will look like the following:

{
  "data": {
    "result": {
      "value": true
    }
  }
}

If the write was unsuccessful then the output would look like the following:

{
  "data": {
    "result": {
      "value": false,
      "error": {
        "type": "FILE_WRITE_ERROR",
        "message": "A message describing the issue."
      }
    }
  }
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.