FileTransfer-LQR471814-0.1.2
توضیحات
A module that makes File Transfer a bit easier.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | FileTransfer-LQR471814-0.1.2 |
| نام | FileTransfer-LQR471814 |
| نسخه کتابخانه | 0.1.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | LQR471814 |
| ایمیل نویسنده | bramblefern1013@gmail.com |
| آدرس صفحه اصلی | https://github.com/LQR471814/FileTransfer |
| آدرس اینترنتی | https://pypi.org/project/FileTransfer-LQR471814/ |
| مجوز | - |
# 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**
```python
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**
```python
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` |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl FileTransfer-LQR471814-0.1.2:
pip install FileTransfer-LQR471814-0.1.2.whl
نصب پکیج tar.gz FileTransfer-LQR471814-0.1.2:
pip install FileTransfer-LQR471814-0.1.2.tar.gz