ftp_download

Downloads a file from the FTP/SFTP server and stores it in DataJet storage. Must be used inside an ftp_session block.

{% ftp_session host: "ftp.example.com", user: "myuser", password: "mypass" %}
  {% ftp_download from: "/exports/data.csv" as result %}

  {% if result.ok %}
    {% log "Downloaded: " %}
    {% log result.file.name %}
  {% endif %}
{% endftp_session %}

Syntax

{% ftp_download from: "/path/to/file" as result_variable %}

Parameters

Parameter
Required
Description

from

Yes

Path to the file on the FTP server

public

No

Set to true to make the file publicly accessible via URL

Result Object

Property
Type
Description

ok

boolean

true if download succeeded

error

string/null

Error message if ok is false, null on success

file.name

string

Name of the downloaded file

file.public

boolean

Whether the file is publicly accessible

file.url

string

Public URL (only present if public: true)

Example result:

Examples

Basic download:

Download with public URL:

Download and process CSV:

Download multiple files:

Notes

  • Must be used inside an ftp_session block

  • Consumes 2 credits per download

  • Downloaded files are stored in DataJet storage

  • Use | content filter to read the file contents after download

  • File size limits apply (10MB default, 50MB for enhanced stores)

Last updated