tiddlers: miniserve临时文件分享服务器
This data as json
title | meta | text | revision |
---|---|---|---|
miniserve临时文件分享服务器 | {"created": "20230404080638220", "creator": "root", "tags": ["\u670d\u52a1\u5668\u4f7f\u7528"], "title": "miniserve\u4e34\u65f6\u6587\u4ef6\u5206\u4eab\u670d\u52a1\u5668", "modified": "20230525055403667", "modifier": "root", "type": "text/vnd.tiddlywiki", "revision": "2"} | !! miniserve - a CLI tool to serve files and dirs over HTTP <<< miniserve 一个分享文件和目录的命令行HTTP服务器 <<< 访问 [[GitHub页面|https://github.com/svenstaro/miniserve]]。 !!! 特点 # 小 # 跨平台 # 命令行操作 !!! 如何使用 一般用法 ```bash ## Serve a directory $ miniserve linux-distro-collection/ ## Serve a single file $ miniserve linux-distro.iso ## Set a custom index file to serve instead of a file listing $ miniserve --index test.html ## Serve an SPA (Single Page Application) so that non-existent paths are forwarded to the SPA's router instead $ miniserve --spa --index index.html ``` 高级用法 ```bash ## Require username/password miniserve --auth joe:123 unreleased-linux-distros/ ## Require username/password as hash $ pw=$(echo -n "123" | sha256sum | cut -f 1 -d ' ') miniserve --auth joe:sha256:$pw unreleased-linux-distros/ ## Generate random 6-hexdigit URL ## Serving path /private/tmp at http://192.168.0.1/c789b6 $ miniserve -i 192.168.0.1 --random-route /tmp ## Bind to multiple interfaces $ miniserve -i 192.168.0.1 -i 10.13.37.10 -i ::1 /tmp/myshare ## Start with TLS $ miniserve --tls-cert my.cert --tls-key my.key /tmp/myshare ``` 上传文件 ```bash ## in one terminal $ miniserve -u -- . ## in another terminal $ curl -F "path=@$FILE" http://localhost:8080/upload\?path\=/ ``` | 3 |