Download File

Overview

The Download File Component allows users to download a file from a given link and store it in the system. It supports specifying a custom filename for the downloaded file.

Usage

This component is used to retrieve files from remote URLs and save them for further processing in workflows.

Properties

Property
Type
Description

link

string

The URL of the file to download.

customFileName

string

Optional. The custom name for the downloaded file, including its extension (e.g., file.png).

Input Ports

Port
Description

in

Accepts the file URL and optional custom filename.

Output Ports

Port
Description

out

Emits the downloaded file's metadata, including file ID, filename, and content type.

Processing Logic

  1. Receives Input Data:

    • Accepts a link to a file and an optional customFileName.

  2. Validates URL:

    • Checks if the provided link is a valid URL.

    • If invalid, throws an error.

  3. Downloads the File:

    • Sends an HTTP request to retrieve the file.

    • Extracts the filename from the response headers or URL if no custom filename is provided.

  4. Saves the File:

    • Stores the file and generates a unique fileId.

  5. Handles Success & Errors:

    • If successful, sends the downloaded file's details to the out port.

    • If an error occurs (e.g., invalid URL or download failure), it is logged or raised appropriately.

Output Data Schema

Property
Type
Description

fileId

string

The unique identifier of the downloaded file.

filename

string

The name of the downloaded file.

contentType

string

The MIME type of the downloaded file.

Notes

  • Validates URLs Before Downloading: Ensures the provided link is a valid file URL.

  • Supports Custom Filenames: Users can specify a filename or rely on the original filename from the response.

  • Ideal for Automated File Retrieval: Useful in workflows that require downloading and storing remote files.

This component is essential for workflows that need to automate file downloads from external sources for further processing.

Last updated