之前在两台电脑之间备份的时候想搞一个局域网传输工具,在网上找了半天没有找到一个好用的东西,用的是utool自带的share,慢的可以,无法忍受(后来证明是路由器的问题),当我把WiFi换成手机热点时,速度飙升到了23~27MB/s
还是记录一下ftpserver:
go install github.com/fclairamb/ftpserver@main
ftpserver &
即可运行
可使用curl
命令上传
curl -v -T tmp1 ftp://test:[email protected]:2121
另外记录一下用Python写的文件上传
from time import time
from flask import Flask, request
app = Flask(__name__)
@app.route("/api/ftp", methods=['POST'])
def ftp():
start = time()
name = request.headers.get("head-filename")
size = request.headers.get("Content-Length")
size = int(size)
f = request.files['file']
f.save(name)
end = time()
print(size)
print(name, "speed: ", size / 1000000 / (end - start), " M/s")
return "ok"
if __name__ == '__main__':
app.run(debug = True, host='0.0.0.0')
使用curl
命令上传
curl -X POST -H "head-filename: sendfile" -F "file=@filename" -F "otherproptery=xxx"
-F
是模拟HTTP的表单输入
multipart/form-data
application/x-www-form-urlencoded