Skip to main content

File and directory transfer over HTTP — Rust speed, Python convenience

Project description

eruspy-python

Python bindings for eruspy — file and directory transfer over HTTP, built with PyO3 and maturin.

Installation

pip install eruspy

Quick Start

Client

import eruspy

c = eruspy.EruspyClient("http://localhost:3000/transfer")

# Upload / download a file
c.upload("./file.txt", "file.txt")
c.download("file.txt", "./received.txt")

# Upload / download a directory
c.upload_dir("./my_folder", "my_folder")
c.download_dir("my_folder", "./restored")

# List a directory ("" = storage root)
entries = c.list("")
for e in entries:
    kind = "DIR" if e.is_dir else "FILE"
    print(f"[{kind}] {e.name}  ({e.size} bytes)")

Server

run_server spawns a background Rust thread and returns immediately. The server keeps the process alive until it exits.

import eruspy, time

eruspy.run_server("./storage", True, "0.0.0.0:3000")
#                  root dir    ^     ^
#                  allow_list ─┘     └─ bind address

print("Server running. Press Ctrl+C to stop.")
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    pass

API Reference

EruspyClient(base_url)

Method Description
upload(local, remote) Upload a file. Parent dir must exist on server.
download(remote, local) Download a file.
upload_dir(local, remote) Upload a directory (zipped). Parent dir must exist on server.
download_dir(remote, local) Download a directory (unzipped locally).
list(remote_path) List a directory. Returns list[FileEntry].

FileEntry

Attribute Type Description
name str File or directory name
is_dir bool True if directory
size int Size in bytes (0 for directories)

run_server(storage, allow_list, host)

Starts the server in a background Rust thread. Returns immediately.

Parameter Type Description
storage str Root directory for stored files (auto-created)
allow_list bool Allow clients to call the /list endpoint
host str Bind address, e.g. "0.0.0.0:3000"

Building from Source

cd eruspy-python
python3 -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop          # dev install into current venv
maturin build --release  # produce a .whl for distribution

License

MIT OR 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

eruspy-0.1.7-cp314-cp314-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

eruspy-0.1.7-cp312-cp312-win_amd64.whl (4.7 MB view details)

Uploaded CPython 3.12Windows x86-64

eruspy-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file eruspy-0.1.7-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eruspy-0.1.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6cd0bd828434f0d59cb22ce8ac4812e4f7cb977081cfb025e84af1dc5abc6e2
MD5 4280643bffe4e14a7b825137bb254b36
BLAKE2b-256 d4f124c611542a1202da9a1e68a8778ff9c330515a8f2c980803a3413d751174

See more details on using hashes here.

File details

Details for the file eruspy-0.1.7-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: eruspy-0.1.7-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for eruspy-0.1.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dc3afb3284d613c538d3e4a4549aa215f1c3bcc2ec33831571d49efb154c0bca
MD5 18cac618eb2e7e7b3ea1ac314cf99d6a
BLAKE2b-256 19b3de481cf23e29f27b395d8253f100c7ef1d2f52e34ff099e22a2caba5c0d9

See more details on using hashes here.

File details

Details for the file eruspy-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eruspy-0.1.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9013bdcd50ff6bfabf579a81df28313ed7e37cd2805ee34670e8f66b7183e407
MD5 d81e49a5d434fffb6b324eca9f6e490d
BLAKE2b-256 2008b0c7be7d770c0869e06b0dae603adaa3d84175fcc03f92b36dccd495a537

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