Skip to content

Uploadtosftp

flowtask.components.UploadToSFTP

UploadToSFTP

UploadToSFTP(loop=None, job=None, stat=None, **kwargs)

Bases: SSHClient, UploadToBase

UploadToSFTP

Overview

    The UploadToSFTP class is a component for uploading files or entire directories to an SSH/SFTP server.
    It supports various configurations, including recursive directory uploads, customizable transfer settings,
    and real-time upload progress tracking.

.. table:: Properties
:widths: auto

    +----------------+----------+-----------+---------------------------------------------------------------+
    | Name           | Required | Summary                                                                   |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | source         |   Yes    | A dictionary specifying the source directory, filename, and/or            |
    |                |          | recursive setting for selecting files to upload.                          |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | destination    |   Yes    | A dictionary defining the target directory on the SFTP server.            |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | whole_dir      |   No     | Boolean indicating if the entire source directory should be uploaded.     |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | block_size     |   No     | Integer defining the block size for file transfer, defaults to 65356.     |
    +----------------+----------+-----------+---------------------------------------------------------------+
    | max_requests   |   No     | Integer setting the max number of parallel requests, defaults to 1.       |
    +----------------+----------+-----------+---------------------------------------------------------------+

Returns

    This component uploads files to the specified SFTP directory and returns a list of uploaded files on success.
    If no files are found or a connection error occurs, it raises a relevant exception. Metrics on the number of
    files uploade


Example:

```yaml
UploadToSFTP:
  host: sftp.example.com
  port: 22
  credentials:
    username: sftpuser
    password: abcd1234
  destination:
    directory: /incoming/
```

run async

run()

Running Download file.

start async

start(**kwargs)

start Method.