当前位置: 首页 > ds >正文

本地文件夹即时变身 Web 服务器(文件服务器)

一:http-server

npm install --global http-server

使用,在一个目录下打开 cmd

 http-server [path] [options]

[path] defaults to ./public if the folder exists, and ./ otherwise.

可以下载文件,但是不能下载文件夹。

二:dufs

Releases · sigoden/dufs

下载 windows 版,然后解压后有一个 dufs.exe 放到项目根目录下,执行

http://127.0.0.1:5000/

样式很漂亮,如果想要下载文件夹得需要配置

用 cmd 执行 dufs.exe --allow-all 就是允许文件夹下载。

Dufs is a distinctive utility file server - https://github.com/sigoden/dufsUsage: 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 download folders as archive file--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--log-file <file>      Specify the file to save logs to, other than stdout/stderr--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

centos 用 docker 方式安装 dufs

首先安装 docker 环境

Alibaba Cloud Linux 3 安装 docker-CSDN博客

下载dufs镜像

docker pull sigoden/dufs

部署dufs应用

  • 创建部署目录
mkdir -p /app/dufs/data && cd /app/dufs/
  • 设置目录权限

编辑部署文件

  • 可以直接使用docker-cli方式部署
docker run -v `pwd`:/data -p 5000:5000 --rm sigoden/dufs /data -A
  • 编辑docker-compose.yaml部署文件
version: '3'
services:dufs:image: sigoden/dufsports:- '5000:5000'volumes:- /app/dufs/data:/datacommand: /data -Arestart: always

可以设置路径别名:command: /data -A --path-prefix dufs

启动镜像

docker compose up -d

卸载镜像

docker compose down

现在可以访问 dufs 了

三:Live Server

vscode 插件,也是不能下载文件夹

http://www.xdnf.cn/news/18680.html

相关文章:

  • 01数据结构-归并排序和计数排序
  • 用 Ansible 优雅部署 Kubernetes 1.33.3(RedHat 10)
  • 文件相关操作的函数和文件操作
  • AlexNet读取数据集 与VGG-11网络
  • 视频编码异常的表现
  • `strchr` 字符串查找函数
  • C++中的右值引用与通用引用:std::move与std::forward的正确使用 (Effective Modern C++ 条款25)
  • 《CF1245D Shichikuji and Power Grid》
  • 嵌入式学习 day57 驱动-驱动框架
  • 国产CANFD芯片技术特性与应用前景综述:以ASM1042系列为例
  • Java试题-选择题(14)
  • 番茄(西红柿)叶片病害检测数据集:12k+图像,10类,yolo标注
  • 2025-08-22 Python进阶10——魔术方法
  • 从原理到实践:朴素贝叶斯算法的魅力解析
  • 构建城市数字孪生底座:深度解析智慧城市全景视频拼接融合解决方案
  • ingress和service区别
  • 未来已来?AI 预测技术在气象、金融领域的应用现状与风险警示
  • python3GUI--Joy音乐播放器 在线播放器 播放器 By:PyQt5(附下载地址)
  • Java面试-== 和 equals() 方法的区别与实现原理
  • Unreal Engine UE_LOG
  • 电脑芯片大的32位与64位指的是什么
  • 【数据结构】B+ 树——高度近似于菌丝网络——详细解说与其 C 代码实现
  • 面向RF设计人员的微带贴片天线计算器
  • AI领域的语义空间是什么?
  • ES6变量与解构:let、const与模板字符串全解析
  • 「越短越合法」型滑动窗口
  • 解释一下,Linux,shell,Vmware,Ubuntu,以及Linux命令和shell命令的区别
  • 111、【OS】【Nuttx】【周边】效果呈现方案解析:-print0 选项
  • Linux操作系统编程——网络
  • 第二阶段WinFrom-6:文件对话框,对象的本地保存,序列化与反序列化,CSV文件操作,INI文件读写