Skip to main content

A TUS-based file transfer tool with chunked upload/download support

Project description

ETransfer

面向大文件场景的高性能传输工具,基于 TUS 协议。支持断点续传、切片上传下载、流式中继(上传未完成即可下载)、阅后即焚,适用于 AI 训练数据集、模型权重等大文件的可靠分发。

特性

  • 基于 TUS 协议的断点续传,网络中断自动恢复
  • 切片上传/下载,支持部分下载(流式中继)
  • 阅后即焚 / TTL 过期 / 永久保存三种文件策略,且永久保存可由服务端策略关闭
  • 离线下载(remote-download):服务端代下载 HuggingFace / 直链 / GDrive 等
  • 插件化的 Source(下载源)+ Sink(推送目标,支持 S3 / TOS / 自建对象存储)
  • 存储配额管理,超限自动等待并恢复
  • 多 IP 负载均衡,自动选择最优节点
  • OIDC 用户系统,基于角色/群组的配额控制
  • CLI + GUI + Python API

安装

pip install etransfer

如需部署服务端(含 SQLAlchemy async 依赖):

pip install "etransfer[server]" --only-binary greenlet

--only-binary greenlet 确保只安装预编译 wheel,避免 Windows 等平台上的 C 编译问题。

快速开始

CLI 入口同时提供 etransfer 与短别名 et。下文统一使用 et

# 配置服务器地址(也可通过 ETRANSFER_SERVER 环境变量)
et setup your-server

# 登录(如果服务器启用了 OIDC)
et login

# 上传:默认 download_once(阅后即焚)
et upload ./model-weights.bin

# 上传保留:永久保存(如果服务端开启了该策略)
et upload ./dataset.tar.gz --retention permanent

# TTL 过期
et upload ./snapshot.tar --retention ttl --retention-ttl 3600

# 多线程加速 + 自定义切片
et upload ./large.iso -j 8 -c $((16*1024*1024))

# 上传到本地,同时流式推送到对象存储 sink
et upload ./model.bin --sink tos

# 下载
et download <file_id> -p ./output/

# 文件 / 目录管理
et list
et folders list
et folders download <folder_id> -p ./out/   # 整目录打包 zip
et folders delete <folder_id>

# 离线下载(服务端代下载)
et remote-download https://example.com/file.zip
et remote-download --urls-file urls.txt --sink tos
cat urls.txt | et remote-download -f -          # 从 stdin 批量提交

# 任务管理
et tasks list
et tasks cancel <task_prefix>
et tasks retry  <task_prefix> --wait
et tasks watch  <task_prefix>                   # 实时查看进度
et tasks wait   <task_prefix>

# 插件 / Sink / Source 浏览
et plugins
et sinks
et sources

# 服务器信息 / 热重载(admin token)
et info
et server reload

完整命令面板见 et --help,按功能分组:Setup / Files / Folders / Offline / Plugins / Server。

进阶使用(Python API)

from etransfer.client.tus_client import EasyTransferClient
from etransfer.client.downloader import ChunkDownloader

# 上传
with EasyTransferClient("http://your-server:8765", token="your-token") as client:
    uploader = client.create_uploader("./large-model.bin", retention="download_once")
    uploader.upload(wait_on_quota=True)
    file_id = uploader.url.split("/")[-1]

# 下载
downloader = ChunkDownloader("http://your-server:8765", token="your-token")
downloader.download_file(file_id, "./output/large-model.bin")

服务端策略:关闭永久保存

如果你的服务端只想把磁盘当成中转,可以在 config.yaml 中关闭 permanent 策略:

retention:
  default: download_once
  allow_permanent: false # 普通用户被拒绝;API token / admin 可继续使用
  • /api/info 会自动从 retention_policies 中剔除 permanent
  • 前端 Upload 页 / Guide 页会隐藏该选项并提示「已被服务器策略禁用」
  • 普通会话用户提交 retention=permanent 会拿到 HTTP 403
  • 静态 API token 调用方(包括 CLI --token)按管理员处理,仍可强制使用

该字段属于热重载字段,et server reload 即时生效。

插件架构

ETransfer 自带 Source(离线下载源)+ Sink(推送目标)两类插件:

  • 内置 Source:directhuggingfacegdrive
  • 内置 Sink:localtos(火山引擎 TOS)
  • 通过 entry_points 注册第三方插件,开发请参考 etransfer/plugins/base_*.py

文档

文档 说明
私有化部署 服务端安装、配置、Docker 部署
通信设计 API 端点与协议说明

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

etransfer-0.1.23.tar.gz (191.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

etransfer-0.1.23-py3-none-any.whl (195.9 kB view details)

Uploaded Python 3

File details

Details for the file etransfer-0.1.23.tar.gz.

File metadata

  • Download URL: etransfer-0.1.23.tar.gz
  • Upload date:
  • Size: 191.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for etransfer-0.1.23.tar.gz
Algorithm Hash digest
SHA256 9b4ba8909f16a01fe3e1a5511384cb1db633e3e9c5c9d63cc047ebb724c6b604
MD5 8db3557de050705e0db11f23f386cf6f
BLAKE2b-256 425b8d2122021745ca15740e711ba0fff98561f240450724411a4ee7e27f96c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for etransfer-0.1.23.tar.gz:

Publisher: publish.yml on ZGCA-Forge/ETransfer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file etransfer-0.1.23-py3-none-any.whl.

File metadata

  • Download URL: etransfer-0.1.23-py3-none-any.whl
  • Upload date:
  • Size: 195.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for etransfer-0.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2b1388637b655bb504702cccf23d39af3c989cd94a160c3cc3bff3513428e4
MD5 3ed22583157dd039d6b3f005ea3f71d4
BLAKE2b-256 eef2d5cdecd33d6835353f7d344cb83bee1d1868804738b4436a23fd524a4505

See more details on using hashes here.

Provenance

The following attestation bundles were made for etransfer-0.1.23-py3-none-any.whl:

Publisher: publish.yml on ZGCA-Forge/ETransfer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page