# file-sync **Repository Path**: tizzybec/file-sync ## Basic Information - **Project Name**: file-sync - **Description**: 一个基于websocket的客户端/服务器双向文件传输软件。 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-02-06 - **Last Updated**: 2022-05-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # file-sync 一个基于websocket的客户端/服务器双向文件传输软件。 ## 安装 ```bash install.bat ``` 安装加速包 ```bash pip install wsaccel pip install ujson ``` # 配置 配置文件放置在~/.file-sync.json,如果不存在,则拷贝config/config.json到~/.file-sync.json ```json { "version": "v1.0.0", // 软件版本 "chunkSize": 5120000, // 传输块大小 "remoteServer": "223.223.177.98:8000", // 远程服务端地址,客户端需要配置 "clientId": "2", // 客户端id "dataDir": "data/client", // 工作目录 "inbox": "data/client/inbox", // inbox目录 "outbox": "data/client/outbox", // outbox目录 "taskTimeoutSeconds": 120, // 任务超时秒数 "logFileName": 'file-sync.log', // 日志文件名称,文件存放在dataDir下 "logLevel": "info", // 日志级别,info、warn、error、debug,默认为error "enableFOD": false // 默认不开启基于目录的文件切割特性,因为硬件环境不一,各端可以按需进行配置 "partSize": 3000, // 文件切割每一块的大小 "queueSize": 100 // 切割目录的队列大小 } ``` ## 运行 启动服务端 linux ```bash ./start-websocket-server.sh ``` windows ```bash .\start-websocket-server.bat ``` 启动客户端 linux ```bash ./start-websocket-client.sh ``` windows ```bash .\start-websocket-client.bat ``` ## 测试 ### 启动服务端 ```bash python manage.py run_server --test 1 --client-id 1 ``` ### 启动客户端 ```bash python manage.py run_server --test 1 --client-id 2 python manage.py run_server --test 1 --client-id 3 python manage.py run_server --test 1 --client-id 4 python manage.py run_server --test 1 --client-id 5 ``` ### 生成测试数据 ```bash python manage.py generate_files --count 100 --send-client '1' --recv-clients '2;3;4;5' --dir 'data/client1/outbox' --basename 'test' python manage.py generate_files --count 100 --send-client '2' --recv-clients '1;3;4;5' --dir 'data/client2/outbox' --basename 'test' ```