chore: improve readme

This commit is contained in:
sigoden 2022-07-08 22:36:16 +08:00
parent 4e823e8bba
commit 00ae36d486

View file

@ -30,7 +30,7 @@ cargo install dufs
### With docker ### With docker
``` ```
docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A
``` ```
### Binaries on macOS, Linux, Windows ### Binaries on macOS, Linux, Windows
@ -79,7 +79,7 @@ Serve current working directory
dufs dufs
``` ```
Explicitly allow all operations including download/upload/delete Allow all operations like upload/delete/search...
``` ```
dufs -A dufs -A
@ -97,24 +97,24 @@ Serve a specific directory
dufs Downloads dufs Downloads
``` ```
Serve a specific file Serve a single file
``` ```
dufs linux-distro.iso dufs linux-distro.iso
``` ```
Serve index.html when requesting a directory Serve a single-page application like react/vue
```
dufs --render-index
```
Serve single-page application like react
``` ```
dufs --render-spa dufs --render-spa
``` ```
Serve a static website with index.html
```
dufs --render-index
```
Require username/password Require username/password
``` ```
@ -141,6 +141,12 @@ dufs --tls-cert my.crt --tls-key my.key
## API ## API
Upload a file
```
curl -T path-to-file http://127.0.0.1:5000/new-path/path-to-file
```
Download a file Download a file
``` ```
curl http://127.0.0.1:5000/path-to-file curl http://127.0.0.1:5000/path-to-file
@ -152,16 +158,10 @@ Download a folder as zip file
curl -o path-to-folder.zip http://127.0.0.1:5000/path-to-folder?zip curl -o path-to-folder.zip http://127.0.0.1:5000/path-to-folder?zip
``` ```
Upload a file
```
curl --upload-file path-to-file http://127.0.0.1:5000/path-to-file
```
Delete a file/folder Delete a file/folder
``` ```
curl -X DELETE http://127.0.0.1:5000/path-to-file curl -X DELETE http://127.0.0.1:5000/path-to-file-or-folder
``` ```
## Access Control ## Access Control