downloadFile

This function enables a file download.

Overview

action ("downloadFile")

Action to be performed.

payload (DownloadFileActionPayload)

Object that describes the content of the file to be downloaded.

DownloadFileActionPayload

base64Encoded (boolean)

Indicates whether the file is base64-encoded.

data (string)

Content of the file.

fileName (string)

Name of the file.

mimeType (string)

File type.

Example

downloadFile.json
{
  "$schema": "https://forms.virtimo.net/5.0.x/schema.json",
  "metaData": {
    "id": 0,
    "version": 0
  },
  "configuration": {
  },
  "components": [
    {
      "type": "container",
      "components": [
        {
          "type": "button",
          "label": "Download base64 encoded file",
          "onClick": {
            "action": "downloadFile",
            "payload": {
              "base64Encoded": true,
              "data": "PG1zZz4KPGNvbnRlbnQ+SGVsbG8gV29ybGQ8L2NvbnRlbnQ+CjwvbXNnPg==",
              "fileName" : "testfile.xml",
              "mimeType": "application/xml"
            }
          }
        },
        {
          "type": "button",
          "label": "Download textfile",
          "onClick": {
            "action": "downloadFile",
            "payload": {
              "fileName" : "testfile.txt",
              "data": "Hello World"
            }
          }
        }
      ]
    }
  ]
}
Embedded preview

Keywords: