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.8-cp38-abi3-win_amd64.whl (4.7 MB view details)

Uploaded CPython 3.8+Windows x86-64

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

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

eruspy-0.1.8-cp38-abi3-macosx_11_0_arm64.whl (5.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file eruspy-0.1.8-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: eruspy-0.1.8-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: CPython 3.8+, 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.8-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a0ebde5f8d2a5773e8617913ed993a71554e8809e43067daecd48cefac6f09a6
MD5 5913baf29b7a208415fcf5f11f28d5a3
BLAKE2b-256 a434eb2cccff2bac246e83a7e4e0d42519ee39eb342a4012fe8e93c51eda4d99

See more details on using hashes here.

File details

Details for the file eruspy-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eruspy-0.1.8-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95acb462b6ff6d7011dd5c9f35139c5be650807b36cacde52f6167cd7df13e1a
MD5 d717a5dc8bd6653be137f55df59312ad
BLAKE2b-256 dd7bdcbf0dc204d7038295fa3f800a9435004b2b7652c9c4c57315b563d9c526

See more details on using hashes here.

File details

Details for the file eruspy-0.1.8-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eruspy-0.1.8-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab76633b98d26935b593479d05591b78428f50fedd692743006626cdce28604a
MD5 f94c7b6653ddc5eb139ba8563900995e
BLAKE2b-256 e3119fc50299f08989f5cc1a9067ce0a1777116eec39ba0d06ed3a48679646cc

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