Skip to main content
The Transfers module manages file uploads and downloads, including queue management, transfer status tracking, and bandwidth control.

Overview

The Transfers module consists of three main classes:
  • Transfers: Main transfer coordinator
  • Downloads: Download-specific management
  • Uploads: Upload-specific management

Transfers Class

Initialization

Core Methods

get_downloads()

Returns the Downloads instance.

get_uploads()

Returns the Uploads instance.

set_transfer_speed_limit()

Sets bandwidth limits for transfers.
int
required
Download speed limit in KB/s (0 for unlimited)
int
required
Upload speed limit in KB/s (0 for unlimited)

Downloads Class

Download Management

add_download()

Adds a file to the download queue.
str
required
Username to download from
str
required
Virtual path of the file on the remote user’s share
int
File size in bytes (if known)
str
Local filesystem path where file will be saved
bool
default:"False"
Place at front of download queue

abort_download()

Aborts an active download.
str
required
Username of the download
str
required
Virtual path of the file

abort_downloads()

Aborts multiple downloads.
list
required
List of (username, virtual_path) tuples

clear_download()

Removes a download from the queue.

retry_download()

Retries a failed download.

Download Queue Methods

get_downloads()

Returns all downloads.
dict
Dictionary mapping (username, virtual_path) to download info

get_active_downloads()

Returns currently active downloads.

get_queued_downloads()

Returns queued downloads waiting to start.

get_user_downloads()

Returns downloads from a specific user.

Download Folders

add_download_folder()

Downloads an entire folder from a user.
str
required
Username to download from
str
required
Virtual folder path
str
Local directory to save files
bool
default:"False"
Prefix local folder name with username

Uploads Class

Upload Management

push_upload()

Queues a file for upload to a user.
str
required
Username requesting the file
str
required
Virtual path in your shares
str
required
Actual filesystem path
int
required
File size in bytes

abort_upload()

Aborts an active upload.

clear_upload()

Removes an upload from the queue.

Upload Queue Methods

get_uploads()

Returns all uploads.
dict
Dictionary mapping (username, virtual_path) to upload info

get_active_uploads()

Returns currently active uploads.

get_queued_uploads()

Returns queued uploads.

get_user_uploads()

Returns uploads to a specific user.

Queue Management

update_upload_limits()

Updates the number of simultaneous upload slots.
int
default:"2"
Number of normal upload slots
int
default:"1"
Number of slots for privileged users

ban_user()

Bans a user from downloading.

unban_user()

Removes a user from the ban list.

Transfer Status

Transfers have several possible statuses:

Events

The Transfers module emits events for tracking transfer progress:

Complete Example

Best Practices

  • Set reasonable bandwidth limits to avoid network congestion
  • Monitor transfer events for real-time progress tracking
  • Use prioritize flag for urgent downloads
  • Handle failed transfers with retry logic
  • Clean up completed transfers periodically
  • Configure upload slots based on your upload bandwidth
  • Use folder downloads for batch operations
  • Implement queue management to control simultaneous transfers