Download File

In this section, we will guide you on how to use the Download File block.

Use Cases

This is a highly useful block for downloading images, videos, PDFs, Excel, CSV, and other files from web pages.

download-file

How It Works

You need to specify the file link, which is usually extracted from the page using Set Variables or Extract Data. You can also specify a custom file name; if left blank, the name from the URL will be applied.

basic-use

Custom File Names

You can customize the file name format using Template Syntax. Tapicker parses the file URL and exposes the file name and extension as the runtime fields $runtime.filename and $runtime.extension, respectively. If these fields are included in the new file name, they will automatically be replaced with the corresponding values.

Examples

Assume the file URL is as follows:

https://www.example.com/image.png

The runtime fields resolved from the URL would be $runtime.filename = image and $runtime.extension = png.

Example 1: Use a random ID for the name

{{getRandomId(8)}}.{{$runtime.extension}} // a3201620.png

Example 2: Add a uniform prefix

test.{{$runtime.filename}}.{{$runtime.extension}} // test.image.png

Example 3: Create a new folder

This is relative to the browser’s download location.

./folder/{{$runtime.filename}}.{{$runtime.extension}} // ./folder/image.png

Example 4: Create a folder based on the date

./{{getDate()|format("YYYY-MM-DD")}}/{{$runtime.filename}}.{{$runtime.extension}} // ./2024-10-28/image.png

Batch Download

To enable batch downloading, you should use this block with the Loop block, like so:

batch-download