Skip to content
Projects

About

A fast, resumable Telegram downloader, uploader and exporter, written in Rust. Command-line tool and full-screen TUI.

Developer Tools

How these counts are measured

What you can do

  • Parallel multi-DC transfers. Dedicated media lanes per data center, with concurrency that backs off on flood waits and recovers on its own.
  • Crash-safe resume. Chunk-level progress in SQLite WAL; an interrupted download refetches only the chunks it never wrote.
  • Two front ends, one engine. Inline progress and receipts in the shell, --json / --jsonl and fixed exit codes for scripts, and a six-view fullscreen TUI.
  • Streaming without downloading. tdln dl --serve puts allowlisted media on 127.0.0.1 with token auth and byte-range seeking for mpv or VLC.

Measured star growth

in 24h
+10
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original
tdl-next logo

tdl-next

Fast, resumable Telegram media transfers from your terminal.
Download, upload, forward, export, and stream with tdln, a Rust rewrite of tdl.

CI Release npm License: AGPL-3.0-only

English · 简体中文 · Docs · Changelog · LINUX DO

tdln tui: the startup banner, queueing three wallpapers from the Chats view, live progress in Transfers, the Network throughput chart, Accounts, History, and the keyboard overlay

A real tdln tui session, recorded against the offline mock Telegram cluster from the test suite.

Why tdl-next

iyear/tdl made Telegram downloads scriptable. tdl-next keeps its command shape and rebuilds the engine in Rust: every data center gets its own pool of media connections, progress is saved per chunk in SQLite so a killed process resumes where it stopped, and the same engine drives a scriptable CLI and a fullscreen TUI. It installs next to Go tdl without sharing a single path or variable.

Highlights

  • Parallel multi-DC transfers. Dedicated media lanes per data center, with concurrency that backs off on flood waits and recovers on its own.
  • Crash-safe resume. Chunk-level progress in SQLite WAL; an interrupted download refetches only the chunks it never wrote.
  • Two front ends, one engine. Inline progress and receipts in the shell, --json / --jsonl and fixed exit codes for scripts, and a six-view fullscreen TUI.
  • Streaming without downloading. tdln dl --serve puts allowlisted media on 127.0.0.1 with token auth and byte-range seeking for mpv or VLC.
  • Filters and safe filenames. Select by extension, MIME prefix, and size, route uploads into forum topics, and name files with templates that cannot escape the target folder.
  • Secrets stay out of the database. Auth keys live in the OS keychain or an Argon2id + ChaCha20-Poly1305 vault, never in SQLite.

Install

# macOS and Linux (checks SHA-256 against the release checksums; no root needed)
curl -fsSL https://raw.githubusercontent.com/beautifulrem/tdl-next/main/scripts/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/beautifulrem/tdl-next/main/scripts/install.ps1 | iex

# npm, pnpm, or bun (or run once with: npx tdl-next)
npm install -g tdl-next
Cargo

Rust 1.96 or newer. Add --no-default-features for a minimal headless build without the TUI and --serve.

cargo install --git https://github.com/beautifulrem/tdl-next.git tdl-cli --locked
Docker
docker run --rm -it \
  -e TDLN_VAULT_PASSPHRASE="change-me" \
  -v "$HOME/.tdl-next:/data" \
  -v "$PWD/downloads:/downloads" \
  ghcr.io/beautifulrem/tdl-next:latest doctor

Prebuilt archives, provenance checks, proxies, and shell completions are in docs/installation.md.

Quick start

tdln version drawing its banner, tdln chat ls listing five chats, and tdln dl downloading three files with live progress and a receipt
# 1. Sign in: import Telegram Desktop, scan a QR code, or use a login code
tdln login -T desktop
tdln login -T qr

# 2. Download a message or a whole album
tdln dl -u https://t.me/telegram/458 -d ./downloads --group

# 3. Export a chat, then fetch its videos up to 500 MiB, resuming anything unfinished
tdln chat export -c @telegram -T last -i 200 -o tdln-export.json
tdln dl -f tdln-export.json -d ./downloads --mime video/ --max-size 524288000 --continue --skip-same

# 4. Stream to a local player instead of downloading first
tdln dl -u https://t.me/telegram/459 --serve --port 8080

# 5. Upload photos as albums, forward a post, or open the TUI
tdln up -p ./photos -c me --photo --group
tdln fwd --from https://t.me/telegram/458 --to me
tdln tui

Use -n <namespace> to keep several accounts apart and tdln doctor to check connectivity and storage. The Quickstart walks through each step, and the CLI reference lists every command and flag.

Fullscreen TUI

tdln tui watches transfers, browses chat media, and switches accounts without leaving the terminal. Press 1–6 to move between views, ? for every key.

Chats view: chats on the left, the selected chat's media on the right Network view: throughput chart above the connection pool
Chats: pick a file and press d to download it Network: throughput, lanes, proxy, and storage health

It follows your terminal's light or dark theme, uses the blue-to-orange brand gradient on truecolor terminals, and falls back to plain text styles under NO_COLOR. See docs/tui.md.

Performance

Loopback benchmarks on an Apple M4 with byte-exact SHA-256 checks. Methodology and raw numbers are in docs/benchmarks.md.

Workload tdln (Rust) Go tdl Peak RSS (tdln)
50 × 64 KiB small-file batch 309.5 ms 5,057.7 ms 13.9 MiB
100 MiB multi-connection download 89.0 ms 247.1 ms 120.0 MiB
200 state/progress writes 26.2 ms 1,636.1 ms 10.4 MiB
4 GiB streaming download (8,192 chunks) 3,056.2 ms (1.34 GiB/s) — 23.5 MiB
Cold --help startup (hyperfine) 4.6–12.0 ms 19.7–34.6 ms 8.9 MiB

Coming from Go tdl

tdln leaves ~/.tdl, TDL_* variables, and _tdl completions alone; its own state lives in ~/.tdl-next under TDLN_*. Bring accounts over with tdln login -T desktop|qr|code, and move them between machines with tdln backup / tdln recover. Flag mappings and the deliberate security differences are in docs/migration.md. The original Go source is archived on the Go branch.

Documentation

Getting started Installation · Quickstart · Migrating from Go tdl
Reference CLI · Fullscreen TUI · Filtering & templates
Engineering Architecture · ADR 0001 · Security design · Benchmarks · Testing · Releasing

All documentation is also available in 简体中文.

Contributing

Read CONTRIBUTING.md before opening a pull request. Report vulnerabilities privately as described in SECURITY.md.

Acknowledgements

tdl-next started from the ideas in iyear/tdl and is built on grammers and ratatui; see NOTICE. Licensed under AGPL-3.0-only.

Thanks to the LINUX DO community for its support.

Explore related projects

Loading…