Skip to main content

高性能文件传输工具 - 基于ZMQ优化的跨网络文件传输系统

Project description

FlaxFile

基于 ZeroMQ 的高性能跨网络文件传输系统。

核心特性

  • 高性能传输:多Socket并发 + 滑动窗口协议,上传/下载速度可达 1.5+ GB/s
  • 安全加密:支持 CurveZMQ (NaCl) 端到端加密传输
  • 增量同步:基于 xxHash3-64 快速哈希,智能跳过未修改文件
  • 异步架构:单端口异步服务器,高并发低延迟
  • 友好界面:Rich 终端进度条,实时显示传输状态

快速开始

安装

pip install -e .

启动服务器

# 默认配置启动
flaxfile serve

# 指定端口和存储目录
flaxfile serve --host 0.0.0.0 --port 25555

# 启用加密(推荐)
export FLAXFILE_PASSWORD="your_password"
flaxfile serve

客户端操作

# 上传文件
flaxfile set /path/to/file.bin [key]

# 下载文件
flaxfile get key [output_path]

# 目录同步(增量)
flaxfile push /local/dir remote_dir
flaxfile pull remote_dir /local/dir

# 列出文件
flaxfile list [prefix]

# 删除文件
flaxfile delete key

Python API

异步 API(推荐)

import asyncio
from flaxfile import MultiSocketFlaxFileClient

async def main():
    client = MultiSocketFlaxFileClient(
        server_host="127.0.0.1",
        port=25555,
        password="your_password"  # 可选
    )

    # 上传/下载(自适应选择最优Socket数量)
    await client.upload_file("video.mp4", "my_video", show_progress=True)
    await client.download_file("my_video", "output.mp4", show_progress=True)

    await client.close()

asyncio.run(main())

同步 API

from flaxfile import MultiSocketFlaxFileClientSync

client = MultiSocketFlaxFileClientSync(server_host="127.0.0.1", port=25555)
try:
    client.upload_file("video.mp4", "my_video", show_progress=True)
    client.download_file("my_video", "output.mp4", show_progress=True)
finally:
    client.close()

配置文件

在项目目录或家目录创建 flaxfile.toml

[client]
default_server = "prod"

[server]
host = "0.0.0.0"
port = 25555
storage_dir = "./zmq_streaming_storage"

[servers.prod]
host = "192.168.1.100"
port = 25555

性能特性

  • 自适应传输策略:根据文件大小自动调整Socket数量和窗口大小
  • 滑动窗口协议:多个chunk并发传输,充分利用网络带宽
  • 异步I/O:aiofiles避免阻塞,保持高并发性能
  • 智能缓存:乱序chunk缓存机制,确保数据正确性

许可证

MIT License

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

flaxfile-1.1.0.tar.gz (41.0 kB view details)

Uploaded Source

Built Distribution

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

flaxfile-1.1.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file flaxfile-1.1.0.tar.gz.

File metadata

  • Download URL: flaxfile-1.1.0.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for flaxfile-1.1.0.tar.gz
Algorithm Hash digest
SHA256 065e6fe90715db5880549cf8262b28033fe545e8804fbecd017703ab1cf4946f
MD5 18597cdaaf065331c8079421545b1f79
BLAKE2b-256 7e441d21a4b7883c0c27e526386baa2160e3efef236c24211dfd0af7338d6ca0

See more details on using hashes here.

File details

Details for the file flaxfile-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: flaxfile-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for flaxfile-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c43d13da030a0a77a54ce0b031ba02b2f875645f3ea03286cb7fcdef5ffc5890
MD5 b6dc4f415598d648355f17b9a8322fa5
BLAKE2b-256 b9f41774cf7984bb5f395f88a5f8e78d477253fd77332a14c1733a9db04d2d10

See more details on using hashes here.

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