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.
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.
Custom File Names
You can customize the file name format using Template Syntax. Tapicker parses the file URL and stores the file name and extension in the internal variables @vars.$filename
and @vars.$extension
, respectively. If these variables 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 internal variables parsed would be $filename = image
and $extension = png
.
Example 1: Use a random ID for the name
{{@funcs.getRandomId(8)}}.{{@vars.$extension}} // a3201620.png
Example 2: Add a uniform prefix
test.{{@vars.$filename}}.{{@vars.$extension}} // test.image.png
Example 3: Create a new folder
This is relative to the browser’s download location.
./folder/{{@vars.$filename}}.{{@vars.$extension}} // ./folder/image.png
Example 4: Create a folder based on the date
./{{@funcs.getDate()|format("YYYY-MM-DD")}}/{{@vars.$filename}}.{{@vars.$extension}} // ./2024-10-28/image.png
Batch Download
To enable batch downloading, you should use this block with the Loop block, like so: