A module that makes File Transfer a bit easier.
Project description
FileTransfer
A python module that makes file transfer slightly easier
Syntax
FileTransfer.send(filepath="", socket=s) : Returns void
FileTransfer.receive(socket=s) : Returns bytes
Usage
Sending
import socket
import FileTransfer as ft
# Setup socket for use in file transfer
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect("ip.address", port)
ft.send(filepath, s) # Specify filepath as str and use client socket object
Receiving
import socket
import FileTransfer as ft
# Setup simple socket receive
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("0.0.0.0", port))
s.listen(1)
conn, addr = s.accept()
result = ft.receive(conn) # Invoke receive function
# Result is a tuple with the file contents being index 0 and filename being index 1
print("Filename: ", result[1], "File Contents: ", result[0])
Protocol (TCP)
| Filename Length | Filename | Payload Length (File Contents Length) | Payload (File Contents) |
|---|---|---|---|
4 Bytes |
Filename encoded (utf8) |
4 bytes |
Payload bytes |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file FileTransfer-LQR471814-0.1.2.tar.gz.
File metadata
- Download URL: FileTransfer-LQR471814-0.1.2.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4e42cc4d9ec96a8f957814e53e1873a1e73542964be6f650ed9e4971d3597c4
|
|
| MD5 |
44fffba4d196478a00e2817607dc048f
|
|
| BLAKE2b-256 |
1f33d5af9e27f3ffa9fa25986dec6b463823a0f35f82f969ef44ebc30f43790d
|
File details
Details for the file FileTransfer_LQR471814-0.1.2-py3-none-any.whl.
File metadata
- Download URL: FileTransfer_LQR471814-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
062210363a0599d901c7938ee570dec7c3660d371daefb34885eddb438ab1943
|
|
| MD5 |
8dbb8e6ae06127b6a5ca1458d70853df
|
|
| BLAKE2b-256 |
4b33c63fb09b34553e82a25d15368086a4a6d744b6267c8e283a3cb3aaa76dd8
|