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 designer server.
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 | storedFileReference |
Display file name | testFileName.txt |
Mime type | text/plain |
File encoding | utf8 |
Example flow
tags: []
sampleInputSchema: ""
sampleData:
fileToStore: testString
description: ""
steps:
- name: Step file-reference
description: ""
config:
action: write
typeOfFile: text
encoding: utf8
forRead: false
documentPath: fileToStore
fileRefPath: storedFileReference
targetPath: storedFileReference
fileName: testFileName.txt
mimeType: text/plain
stepType: file-reference
condition: ""
Result
{
"doc": {
"fileToStore": "testString",
"storedFileReference": {
"id": "52ef9780-606e-4ee7-adaa-e4a2a6aa8f78",
"contentType": "text/plain",
"extension": ".txt",
"fileName": "testFileName.txt"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 3
}
],
"executionTimeOfFlow": 3,
"timeMetric": "ms"
}
}
Example for writing binary file
Input
{
"fileToStore": "dGVzdFN0cmluZw=="
}
Step configuration
Input | Value |
---|---|
Action | write |
Document path | fileToStore |
File type | binary |
Target path | storedFileReference |
Display file name | testFile.bin |
Mime type | application/octet-stream |
Example flow
tags: []
sampleInputSchema: ""
sampleData:
fileToStore: dGVzdFN0cmluZw==
description: ""
steps:
- name: Step file-reference
description: ""
config:
action: write
typeOfFile: binary
encoding: utf8
forRead: false
documentPath: fileToStore
fileRefPath: storedFileReference
targetPath: storedFileReference
fileName: testFile.bin
mimeType: application/octet-stream
stepType: file-reference
condition: ""
Result
{
"doc": {
"fileToStore": "dGVzdFN0cmluZw==",
"storedFileReference": {
"id": "0e9d502a-1056-4f0f-944f-9a0490f5efb4",
"contentType": "application/octet-stream",
"extension": ".bin",
"fileName": "testFile.bin"
}
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 2
}
],
"executionTimeOfFlow": 2,
"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 | storedFileReference |
Target path | readTextFile |
File encoding | utf8 |
Example flow
tags: []
sampleInputSchema: ""
sampleData:
fileToStore: testString
description: ""
steps:
- name: Step file-reference
description: ""
config:
action: write
typeOfFile: text
encoding: utf8
forRead: false
documentPath: fileToStore
fileRefPath: storedFileReference
targetPath: storedFileReference
fileName: testFileName.txt
mimeType: text/plain
stepType: file-reference
condition: ""
- name: Step file-reference 2
description: ""
config:
action: read
typeOfFile: text
encoding: utf8
fileRefPath: storedFileReference
targetPath: readTextFile
stepType: file-reference
condition: ""
Result
{
"doc": {
"fileToStore": "testString",
"storedFileReference": {
"id": "d08611ed-4ac9-4316-b5b3-cffd6a5c8b17",
"contentType": "text/plain",
"extension": ".txt",
"fileName": "testFileName.txt"
},
"readTextFile": "testString"
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 3
},
{
"step": "file-reference",
"executionTime": 2
}
],
"executionTimeOfFlow": 5,
"timeMetric": "ms"
}
}
Example for read binary file
Input
{
"fileToStore": "dGVzdFN0cmluZw=="
}
Step configuration
Input | Value |
---|---|
Action | read |
File type | binary |
File reference path | storedFileReference |
Target path | readBinaryFileAsBase64 |
Example flow
tags: []
sampleInputSchema: ""
sampleData:
fileToStore: dGVzdFN0cmluZw==
description: ""
steps:
- name: Step file-reference
description: ""
config:
action: write
typeOfFile: binary
encoding: utf8
forRead: false
documentPath: fileToStore
fileRefPath: storedFileReference
targetPath: storedFileReference
fileName: testFile.bin
mimeType: application/octet-stream
stepType: file-reference
condition: ""
- name: Step file-reference
description: ""
config:
action: read
typeOfFile: binary
encoding: utf8
fileRefPath: storedFileReference
targetPath: readBinaryFileAsBase64
stepType: file-reference
condition: ""
Result
{
"doc": {
"fileToStore": "dGVzdFN0cmluZw==",
"storedFileReference": {
"id": "db76866f-45ee-46f9-b6e7-977ded578178",
"contentType": "application/octet-stream",
"extension": ".bin",
"fileName": "testFile.bin"
},
"readBinaryFileAsBase64": "dGVzdFN0cmluZw=="
},
"errors": [],
"performance": {
"steps": [
{
"step": "file-reference",
"executionTime": 2
},
{
"step": "file-reference",
"executionTime": 2
}
],
"executionTimeOfFlow": 4,
"timeMetric": "ms"
}
}