File Exchange
The File Exchange container allows Trust1Connector to upload or download files from the filesystem to the requesting party. In order to be able to access the file system, a separate
file_exchange
consent is required.The File Exchange container provides the following functionalities:
- selecting a folder to use (using system folder selection mechanism)
- listing files in selected folder
- downloading a provided file into selected folder
- uploading a file from the selected folder
The following functions are available in the T1C-JS library:
JavaScript API |
Function | Input | Output | Description |
downloadFile | path, file, fileName | N/A | Creates a file named fileName at the path location, with file contents file |
listFiles | { path, extensions } | list of files in directory | Returns a list of all files in the path directory that have an extension included in the extensions array |
setFolder | N/A | path of selected directory | Triggers a system file selection dialog that allows the user to select a directory. The selected directory is returned as the response |
uploadFile | path | fileBuffer | Will retrieve the file located at path and return it as a fileBuffer |
Downloads a provided file(Buffer) into the provided directory.
downloadFile(path: string, file: ArrayBuffer, fileName: string)
- path: location for the newly created file
- file: ArrayBuffer containing binary data to be put in the file
- fileName: name to be given to the file
{
data: string // absolute path of the newly created file
success: boolean
}
Returns a list of files in the selected directory.
listFiles({ path: string, extensions: string[] }, callback: (error, data))
- dataObject containing two config parameters:
- path: directory to list
- extensions: array of file extensions to be included in the list
{
data: [{
extension: string,
last_modification_time: string,
name: string,
path: string,
size: number
}],
success: boolean
}
Triggers system dialog to select a folder
setFolder(callback?: (error, data))
- none
{
data: string // path of the selected folder
success: boolean
}
Uploads the file located at
path
to the requesting user.uploadFile(path: string)
- feature: absolute path to the requested file
fileBuffer
Last modified 4yr ago