# devgaganin/devgagantools architecture

> Architecture diagram of the GitHub repository devgaganin/devgagantools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devgaganin/devgagantools
- Repository: https://github.com/devgaganin/devgagantools

## Overview

devgagantools is a small asynchronous Telegram file-transfer library. Its main workflows wrap uploads and downloads with filename handling, optional progress updates, and local-file management; shared utilities provide throttling and human-readable progress formatting. The sampled source shows parallel MTProto transfer machinery and upload-part handling. Some download internals are omitted, so the graph avoids detailing their wiring.

Main entry points: [`devgagantools/__init__.py`](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py) (fast_upload), [`devgagantools/spylib.py`](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py) (ParallelTransferrer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Transfer API"]
  node_fast_download["fast_download<br/>[__init__.py]"]
  node_fast_upload["fast_upload<br/>[__init__.py]"]
end

subgraph group_progress["Progress Utilities"]
  node_timer["Timer<br/>[__init__.py]"]
  node_progress_bar["Progress display<br/>[__init__.py]"]
  node_size_format["Size formatter<br/>[__init__.py]"]
end

subgraph group_engine["Transfer Engine"]
  node_download_file["download_file<br/>[spylib.py]"]
  node_upload_file["upload_file<br/>[spylib.py]"]
  node_parallel_transfer["ParallelTransferrer<br/>[spylib.py]"]
  node_download_sender["DownloadSender<br/>[spylib.py]"]
  node_upload_sender["UploadSender<br/>[spylib.py]"]
end

node_user(("Library caller"))
node_telegram_client(("Telegram client"))
node_telegram_api{{"Telegram MTProto"}}
node_local_files[("Local files")]
node_reply_message(("Reply message"))

node_user -->|"requests download"| node_fast_download
node_user -->|"requests upload"| node_fast_upload
node_fast_download -->|"downloads file"| node_download_file
node_download_file -->|"writes result"| node_local_files
node_fast_upload -->|"reads source"| node_local_files
node_fast_upload -->|"uploads file"| node_upload_file
node_fast_download -->|"throttles updates"| node_timer
node_fast_upload -->|"throttles updates"| node_timer
node_fast_download -->|"formats progress"| node_progress_bar
node_fast_upload -->|"formats progress"| node_progress_bar
node_progress_bar -->|"formats sizes"| node_size_format
node_fast_download -->|"edits progress"| node_reply_message
node_fast_upload -->|"edits progress"| node_reply_message
node_upload_file -->|"initializes transfer"| node_parallel_transfer
node_upload_file -->|"sends parts"| node_parallel_transfer
node_parallel_transfer -->|"creates senders"| node_download_sender
node_parallel_transfer -->|"creates senders"| node_upload_sender
node_download_sender -->|"requests file parts"| node_telegram_client
node_upload_sender -->|"saves file parts"| node_telegram_client
node_telegram_client -->|"sends MTProto requests"| node_telegram_api

click node_fast_download "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py"
click node_download_file "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py"
click node_fast_upload "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py"
click node_upload_file "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py"
click node_timer "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py"
click node_progress_bar "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py"
click node_size_format "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py"
click node_parallel_transfer "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py"
click node_download_sender "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py"
click node_upload_sender "https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_fast_download,node_fast_upload,node_telegram_client toneBlue
class node_timer,node_progress_bar,node_size_format,node_local_files toneAmber
class node_download_file,node_upload_file,node_parallel_transfer,node_download_sender,node_upload_sender toneMint
class node_user,node_telegram_api,node_reply_message toneIndigo
```

## Components

### Transfer API

- [fast_download](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py): `devgagantools/__init__.py`
- [fast_upload](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py): `devgagantools/__init__.py`

### Progress Utilities

- [Timer](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py): `devgagantools/__init__.py`
- [Progress display](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py): `devgagantools/__init__.py`
- [Size formatter](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/__init__.py): `devgagantools/__init__.py`

### Transfer Engine

- [download_file](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py): `devgagantools/spylib.py`
- [upload_file](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py): `devgagantools/spylib.py`
- [ParallelTransferrer](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py): `devgagantools/spylib.py`
- [DownloadSender](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py): `devgagantools/spylib.py`
- [UploadSender](https://github.com/devgaganin/devgagantools/blob/main/devgagantools/spylib.py): `devgagantools/spylib.py`

### Other components

- **Library caller**
- **Telegram client**
- **Telegram MTProto**
- **Local files**
- **Reply message**

## Connections

- Library caller → fast_download: requests download
- Library caller → fast_upload: requests upload
- fast_download → download_file: downloads file
- download_file → Local files: writes result
- fast_upload → Local files: reads source
- fast_upload → upload_file: uploads file
- fast_download → Timer: throttles updates
- fast_upload → Timer: throttles updates
- fast_download → Progress display: formats progress
- fast_upload → Progress display: formats progress
- Progress display → Size formatter: formats sizes
- fast_download → Reply message: edits progress
- fast_upload → Reply message: edits progress
- upload_file → ParallelTransferrer: initializes transfer
- upload_file → ParallelTransferrer: sends parts
- ParallelTransferrer → DownloadSender: creates senders
- ParallelTransferrer → UploadSender: creates senders
- DownloadSender → Telegram client: requests file parts
- UploadSender → Telegram client: saves file parts
- Telegram client → Telegram MTProto: sends MTProto requests
