一個由Rust開發的靜態文件服務dufs

2024年2月6日 33点热度 0人点赞

簡介

dufs是一個由Rust語言發的支持靜態服務、上傳、搜索、訪問控制、文件服務,可在Windows、Mac、Linux中部署。Github鏈接:
https://github.com/sigoden/dufs

瀏覽器訪問展示

特點

1 由Rust語言開發

2 將文件夾下載為 zip 文件

3 上傳文件和文件夾(拖放)

4 創建/編輯/搜索文件

5 可恢復/部分上傳和下載

6 訪問控制

7 支持 HTTPS

8 支持 WebDAV

9 可通過curl進行相關操作
如果在 Dufs 目錄中有 HTML 網站,則可以瀏覽所有頁面。

安裝

使用cargo安裝,docker部署,Homebrew等方式進行安裝使用

操作

以下為dufs操作幫助介紹

Usage: dufs [OPTIONS] [serve-path]
Arguments:
[serve-path] Specific path to serve [default: .]
Options:
-c, --config <file> Specify configuration file
-b, --bind <addrs> Specify bind address or unix socket
-p, --port <port> Specify port to listen on [default: 5000]
--path-prefix <path> Specify a path prefix
--hidden <value> Hide paths from directory listings, e.g. tmp,*.log,*.lock
-a, --auth <rules> Add auth roles, e.g. user:pass@/dir1:rw,/dir2
-A, --allow-all Allow all operations
--allow-upload Allow upload files/folders
--allow-delete Allow delete files/folders
--allow-search Allow search files/folders
--allow-symlink Allow symlink to files/folders outside root directory
--allow-archive Allow zip archive generation
--enable-cors Enable CORS, sets `Access-Control-Allow-Origin: *`
--render-index Serve index.html when requesting a directory, returns 404 if not found index.html
--render-try-index Serve index.html when requesting a directory, returns directory listing if not found index.html
--render-spa Serve SPA(Single Page Application)
--assets <path> Set the path to the assets directory for overriding the built-in assets
--log-format <format> Customize http log format
--compress <level> Set zip compress level [default: low] [possible values: none, low, medium, high]
--completions <shell> Print shell completion script for <shell> [possible values: bash, elvish, fish, powershell, zsh]
--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
-V, --version Print version

總結

這是使用過比較簡單的文件服務,還可通過命令行等操作,值得嘗試