# Dufs
[](https://github.com/sigoden/dufs/actions/workflows/ci.yaml)
[](https://crates.io/crates/dufs)
Dufs is a simple file server. Support static serve, search, upload, webdav...
> dufs is a rename of duf, see [#50](https://user-images.githubusercontent.com/4012553/174461776-25029dfc-fff5-42ff-a39a-adfe4daf7dde.png)

## Features
- Serve static files
- Download folder as zip file
- Upload files and folders (Drag & Drop)
- Search files
- Partial responses (Parallel/Resume download)
- Authentication
- Support https
- Support webdav
- Easy to use with curl
## Install
### With cargo
```
cargo install dufs
```
### With docker
```
docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data
```
### Binaries on macOS, Linux, Windows
Download from [Github Releases](https://github.com/sigoden/dufs/releases), unzip and add dufs to your $PATH.
## CLI
```
Dufs is a simple file server. - https://github.com/sigoden/dufs
USAGE:
dufs [OPTIONS] [--] [path]
ARGS:
<path> Path to a root directory for serving files [default: .]
OPTIONS:
-b, --bind <addr>... Specify bind address
-p, --port <port> Specify port to listen on [default: 5000]
--path-prefix <path> Specify an url path prefix
-a, --auth <user:pass> Use HTTP authentication
--no-auth-access Not required auth when access static files
-A, --allow-all Allow all operations
--allow-upload Allow upload files/folders
--allow-delete Allow delete files/folders
--allow-symlink Allow symlink to files/folders outside root directory
--render-index Render index.html when requesting a directory
--render-try-index Render index.html if it exists when requesting a directory
--render-spa Render for single-page application
--cors Enable CORS, sets `Access-Control-Allow-Origin: *`
--tls-cert <path> Path to an SSL/TLS certificate to serve with HTTPS
--tls-key <path> Path to the SSL/TLS certificate's private key
-h, --help Print help information
-V, --version Print version information
```
## Examples
Serve current working directory, no upload/delete
```
dufs
```
Allow upload/delete
```
dufs -A
```
Listen on a specific port
```
dufs -p 80
```
Protect with authentication
```
dufs -a admin:admin
```
For a single page application (SPA)
```
dufs --render-spa
```
Use https
```
dufs --tls-cert my.crt --tls-key my.key
```
## API
Download a file
```
curl http://127.0.0.1:5000/some-file
```
Download a folder as zip file
```
curl -o some-folder.zip http://127.0.0.1:5000/some-folder?zip
```
Upload a file
```
curl --upload-file some-file http://127.0.0.1:5000/some-file
```
Delete a file/folder
```
curl -X DELETE http://127.0.0.1:5000/some-file
```
## License
Copyright (c) 2022 dufs-developers.
dufs is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
See the LICENSE-APACHE and LICENSE-MIT files for license details.