File reference
Overview
File reference has two functionalities, read and write.
writes the content present in document path into file and returns corresponding file reference.
reads the file content into document path using file reference.
Configuration
Action
write or read - write doc path into file reference or read file reference into doc path.
Document path
doc path of file content to be written as file.
Target path
doc path to store the file reference corresponding to written file (in case of write action) or to store read file content(in case of read action).
File type
text or binary- type of file to be written/read.
Mime type
Optional parameter to define mime type of the file to be written.
Display file name
Optional parameter to define file name of the file to be written.
File encoding
utf8,utf16le or latin1 - encoding of text file to be written/read.
File reference path
doc path of file reference to read file.
Binary file content to be written in file is expected in base64 format and read file content(binary) from file reference is converted into base64 and stored into doc path.
File size limit for reading file content is by default 5MB and can be configured using ACE_FILE_REF_DOC_LIMIT_MB environment variable in flow runner.
Examples for write action
Example for writing text file
Input
{
"fileToStore": "testString"
}
Step configuration
| Input | Value |
|---|---|
| Action | write |
| Document path | fileToStore |
| File type | text |
| Target path | result |
| Display file name | testFileName.txt |
| Mime type | text/plain |
| File encoding | utf8 |
Example flow
{
"id": "f11302de-81f8-4f6a-99fd-a0bf1f3a1469",
"name": "fileWriteText",
"flow": {
"name": "fileWriteText",
"description": "",
"steps": [
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": false,
"config": {
"action": "write",
"typeOfFile": "text",
"encoding": "utf8",
"fileRefPath": "fileTo",
"documentPath": "fileToStore",
"targetPath": "result",
"fileName": "testFileName.txt",
"mimeType": "text/plain"
},
"textColor": "black"
}
]
},
"inputSchema": {
"fileToStore": "testString"
},
"createDate": "2023-07-05T06:15:12.480Z",
"tags": [
"general"
],
"inputSchemaLabel": "",
"version": 1
}
Result
{
"doc": {
"fileToStore": "testString",
"result": {
"id": "0d5ce94d-db06-41c6-a355-3b6d2aba0443",
"contentType": "text/plain",
"extension": ".txt",
"fileName": "testFileName.txt"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 17
}
],
"executionTimeOfFlow": 17,
"timeMetric": "ms"
}
}
Example for writing binary file
Input
{
"fileToStore": "dGVzdFN0cmluZw=="
}
Step configuration
| Input | Value |
|---|---|
| Action | write |
| Document path | fileToStore |
| File type | binary |
| Target path | result |
| Display file name | testFile.bin |
| Mime type | application/octet-stream |
Example flow
{
"id": "2c1da52a-800e-4d57-8c12-aa3d57fed13e",
"name": "fileWriteBinary",
"flow": {
"name": "fileWriteBinary",
"description": "",
"steps": [
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": false,
"config": {
"action": "write",
"typeOfFile": "binary",
"encoding": "utf8",
"fileRefPath": "fileToStore",
"targetPath": "result",
"documentPath": "fileToStore",
"fileName": "testFile.bin",
"mimeType": "application/octet-stream"
},
"textColor": "black"
}
]
},
"inputSchema": {
"fileToStore": "dGVzdFN0cmluZw=="
},
"createDate": "2023-07-05T06:17:49.268Z",
"tags": [
"general"
],
"inputSchemaLabel": "",
"version": 1
}
Result
{
"doc": {
"fileToStore": "dGVzdFN0cmluZw==",
"result": {
"id": "4e501cb8-94a9-4d06-b9be-01beac167381",
"contentType": "application/octet-stream",
"extension": ".bin",
"fileName": "testFile.bin"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 12
}
],
"executionTimeOfFlow": 12,
"timeMetric": "ms"
}
}
Examples for read action
Example for read text file
Input
{
"fileToStore": "testString"
}
Step configuration
| Input | Value |
|---|---|
| Action | read |
| File type | text |
| File reference path | result |
| Target path | resultFile |
| File encoding | utf8 |
Example flow
{
"id": "f11302de-81f8-4f6a-99fd-a0bf1f3a1469",
"name": "fileReadText",
"flow": {
"name": "fileReadText",
"description": "",
"steps": [
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": false,
"config": {
"action": "write",
"typeOfFile": "text",
"encoding": "utf8",
"fileRefPath": "fileTo",
"documentPath": "fileToStore",
"targetPath": "result",
"fileName": "testFileName.txt",
"mimeType": "text/plain"
},
"textColor": "black"
},
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": true,
"config": {
"action": "read",
"typeOfFile": "text",
"encoding": "utf8",
"fileRefPath": "result",
"targetPath": "resultFile"
},
"textColor": "black"
}
]
},
"inputSchema": {
"fileToStore": "testString"
},
"createDate": "2023-07-05T06:15:12.480Z",
"tags": [
"general"
],
"inputSchemaLabel": "",
"version": 1
}
Result
{
"doc": {
"fileToStore": "testString",
"result": {
"id": "0e91b092-d55b-490d-91e1-22654405fc3e",
"contentType": "text/plain",
"extension": ".txt",
"fileName": "testFileName.txt"
},
"resultFile": "testString"
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 14
},
{
"step": "file-reference",
"executionTime": 10
}
],
"executionTimeOfFlow": 26,
"timeMetric": "ms"
}
}
Example for read binary file
Input
{
"fileToStore": "dGVzdFN0cmluZw=="
}
Step configuration
| Input | Value |
|---|---|
| Action | read |
| File type | binary |
| File reference path | result |
| Target path | resultFile |
Example flow
{
"id": "2c1da52a-800e-4d57-8c12-aa3d57fed13e",
"name": "fileReadBinary",
"flow": {
"name": "fileReadBinary",
"description": "",
"steps": [
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": false,
"config": {
"action": "write",
"typeOfFile": "binary",
"encoding": "utf8",
"fileRefPath": "fileToStore",
"targetPath": "result",
"documentPath": "fileToStore",
"fileName": "testFile.bin",
"mimeType": "application/octet-stream"
},
"textColor": "black"
},
{
"stepType": "file-reference",
"color": "rgb(247,225,211)",
"displayName": "File Reference",
"isSelected": true,
"config": {
"action": "read",
"typeOfFile": "binary",
"encoding": "utf8",
"fileRefPath": "result",
"targetPath": "resultFile"
},
"textColor": "black"
}
]
},
"inputSchema": {
"fileToStore": "dGVzdFN0cmluZw=="
},
"createDate": "2023-07-05T06:17:49.268Z",
"tags": [
"general"
],
"inputSchemaLabel": "",
"version": 1
}
Result
{
"doc": {
"fileToStore": "dGVzdFN0cmluZw==",
"result": {
"id": "91a8a818-ff51-42fc-a7fc-5c11663d0324",
"contentType": "application/octet-stream",
"extension": ".bin",
"fileName": "testFile.bin"
},
"resultFile": "dGVzdFN0cmluZw=="
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 10
},
{
"step": "file-reference",
"executionTime": 12
}
],
"executionTimeOfFlow": 22,
"timeMetric": "ms"
}
}