Create Download Activity

Description

The Create Download activity is used to create a download link for arbitrary content that can be passed to a client workflow and presented to a user. The download link has a limited lifespan and can only be accessed in network environments that can access the server.

Usage

The Create Download activity could be used to create a download link for file content read with the Read File Bytes activity. This URL could be set as an output of the server workflow with the Set Workflow Output activity. Finally, a clickable link could be presented in a form by using the markdown option in the Set Form Element Property activity.

Inputs

Content

Required

Type: String | Number[]

The text or byte content of the file.

Bytes are the raw binary values that represent content. A byte array is represented by a list of numbers between 0 and 255.

Providing empty or invalid content will cause an error.

Content Type

Optional

Type: "application/json" | "application/octet-stream" | "application/pdf" | "application/xml" | "application/zip" | "image/jpeg" | "image/png" | "text/csv" | "text/html" | "text/plain" | String

The MIME type of the content. Workflow Server supports any MIME type defined in the apache and nginx lists as of 2019-12-04.

If the Content Type input is blank or invalid, the MIME type will be determined from the file extension in the Filename input. If this is not possible, the MIME type will be determined from the type of the Content input. String content will use the "text/plain" MIME type, and byte content will use the "application/octet-stream" MIME type.

More information about MIME types can be found here.

Filename

Required

Type: String

The full name (with the extension) that the file will be saved as when the user downloads it.

A filename that is too long, empty, or has invalid characters, such as slashes or colons, will cause an error.

The following file extensions represent executables and will cause an error as these file types are a security risk to the end user:

  • .app
  • .bat
  • .bin
  • .deb
  • .dmg
  • .elf
  • .exe
  • .jar
  • .js
  • .msi
  • .py
  • .sh

Open in browser

Optional

Type: Boolean

True if Workflow Server should attempt to show the file contents directly in the browser, false if the file should be downloaded. The default value is true.

Note that the exact behaviour of this input can depend on the browser as it may force the user to save a file that might be otherwise safe to show directly.

If a value of true is provided, the file will not be shown in the browser unless it is considered a safe type.

The following file extensions are considered safe for displaying in the browser:

  • .aif
  • .avi
  • .csv
  • .flv
  • .jpeg
  • .jpg
  • .json
  • .mov
  • .mp3
  • .mp4
  • .mp4
  • .mpeg
  • .mpg
  • .pdf
  • .png
  • .ppt
  • .pptx
  • .rtf
  • .svg
  • .tiff
  • .txt
  • .wav
  • .wmv
  • .xls
  • .xlsx
  • .xml

The following MIME types are considered safe for displaying in the browser:

  • application/json
  • application/octet-stream
  • application/ogg
  • application/pdf
  • application/rtf
  • application/vnd.ms-excel
  • application/vnd.ms-powerpoint
  • application/vnd.openxmlformats-officedocument.presentationml.presentation
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • application/xml
  • audio/3gpp
  • audio/3gpp2
  • audio/mpeg
  • audio/ogg
  • audio/wav
  • audio/webm
  • audio/x-aiff
  • image/jpeg
  • image/png
  • image/svg+xml
  • image/tiff
  • text/csv
  • text/plain
  • text/rtf
  • text/xml
  • video/3gpp
  • video/3gpp2
  • video/mp4
  • video/mpeg
  • video/ogg
  • video/quicktime
  • video/webm
  • video/x-flv
  • video/x-ms-wmv
  • video/x-msvideo
  • video/x-msvideo

Expiry

Optional

Type: Number

The time until the download link expires, in minutes. After this time period has passed, the download link no longer allows access to the file.

If a value is not given or the value is invalid, the default value of seven days is used. A shorter expiration time provides higher security.

If you use a value that is longer than the limit defined by the Server Retention Policy, it will have no effect. The download will be deleted based on that schedule.

Outputs

url

Type: String

The download link URL. Accessing this URL will download or display the file.

Properties

For information about the ID, Display Name, and Description properties, see Properties Common to all Activities.

Connectivity Requirements

This activity does not work when the device has intermittent connectivity to the network.