Skip to main content

File: Get Node

The File: Get Node allows a workflow to retrieve an Application File, including its meta information and either its contents or a URL to download the contents.

File: Get Node

Node Properties

There are three main configuration sections for the File: Get Node ...

File Configuration

First, choose whether the node is retrieving a Public Application File (default) or a Private Application File.

Then, enter a File Path Template, which is a string template that resolves to the path of the file to retrieve (relative to the Application Files root directory). For example, to retrieve a file named report.pdf in a directory named documents, the File Path Template would be /documents/report.pdf.

Result Type

Next, choose what to place on the payload by selecting either Get File Contents or Get Download Link.

When selecting Get File Contents, you must also select a File Encoding. This determines how the file's raw binary data is converted into a string for placement on the payload. Options include: ASCII, UTF-8, UTF-16LE, Base64, Binary, Hex. The default is UTF-8.

Output

Finally, enter a Result Path, which is a payload path for where to store the result of the operation.

When selecting Private Application File in the file configuration and the Get Download Link result type, you may also provide a custom URL TTL Template. This is a string template that resolves to the number of seconds the generated URL will remain valid. If left blank, the default TTL of 900 seconds (15 minutes) will be used.

If the node is successful, the value placed at the path will be an object with the following properties:

  • value: Either the file's contents (in your selected file encoding) or a URL to download the contents.
  • metadata: An object containing information about the file, including its name, size in bytes, creation date, and more.

In the event of an error, the value placed at the path will be an object with an error property, whose value is a string describing the error.

Node Example

Depending on the settings applied to the node, portions of the output will vary.

Retrieving File Contents

Given the following settings ...

  • Public Application File
  • File Path Template: /hello/world.txt (the file contains the text "Here is the PUBLIC contents")
  • Result Type: Get File Contents
  • File Encoding: UTF-8
  • Result Path: working.fileData

... the following will be placed on the payload upon successful execution of the node at the specified result path:

{
"value": "Here is the PUBLIC contents",
"metadata": {
"_type": "file",
"authorId": "<ID of entity that created the file>",
"authorType": "user|flow|apiToken|notebook",
"name": "world.txt",
"parentDirectory": "/hello/",
"type": "file",
"fileSize": 27,
"contentType": "text/plain",
"applicationId": "<applicationId>",
"lastUpdated": "2025-10-20T20:58:30.012Z",
"creationDate": "2025-10-20T20:58:29.888Z",
"status": "completed",
"s3etag": "cc3a241a48405d0c62f69feb6b6cbd6f",
"id": "68f6a2752a5e69ab30a09243",
"url": "https://files.onlosant.com/<applicationId>/hello/world.txt"
}
}

Note that, even though we are retrieving the contents of a public file, the metadata.url property still exists and provides a URL to download the file. If we were retrieving the contents of a private file instead, the metadata.url property would not be defined.

Given the following settings ...

  • Private Application File
  • File Path Template: /hello/world.txt
  • Result Type: Get Download Link
  • Result Path: working.fileData
  • URL TTL Template: 60

... the following will be placed on the payload upon successful execution of the node at the specified result path:

{
"value": "https://losant-private-files.s3.us-west-2.amazonaws.com/<applicationId>/<file-path>?X-Amz-Algorithm=....",
"metadata": {
"_type": "privateFile",
"authorId": "<ID of entity that created the file>",
"authorType": "user|flow|apiToken|notebook",
"name": "world.txt",
"parentDirectory": "/hello/",
"type": "file",
"fileSize": 28,
"contentType": "text/plain",
"applicationId": "<applicationId>",
"lastUpdated": "2025-10-20T20:58:30.012Z",
"creationDate": "2025-10-20T20:58:29.888Z",
"status": "completed",
"s3etag": "cc3a241a48405d0c62f69feb6b6cbd6f",
"id": "68f6a2752a5e69ab30a09243",
"url": "https://losant-private-files.s3.us-west-2.amazonaws.com/<applicationId>/<file-path>?X-Amz-Algorithm=...."
}
}

In this scenario, the metadata.url property exists and matches the value of the value property since we are retrieving a download URL, regardless of if this is a public or private file.

Node Errors

The most common error is attempting to retrieve a file that does not exist. In this case, given a the following will be placed on the payload at the specified result path:

{
"error": {
"type": "NotFound",
"message": "File was not found"
}
}

Was this page helpful?


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