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

本地文件夹即时变身 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.dtcms.com/a/346648.html

相关文章:

  • Linux问答题:归档和传输文件
  • Reactor 反应堆模式
  • 《解构React Server Components:服务端序列化与流式传输的底层逻辑》
  • 为什么在WHERE子句里使用函数,会让索引失效
  • 中农具身导航赋能智慧农业!AgriVLN:农业机器人的视觉语言导航
  • 【数据结构】计数排序:有时比快排还快的整数排序法
  • Linux PCI 子系统:工作原理与实现机制深度分析
  • 并查集详解
  • 第三阶段数据库-9:循环,编号,游标,分页
  • 【数据分析】宏基因组荟萃分析(Meta-analysis)的应用与实操指南
  • ES作为推荐库的设计原理
  • 配置npm国内源(包含主流npm镜像源地址)
  • Docker之nginx安装
  • 青少年机器人技术(五级)等级考试试卷(2020年9月)
  • docker的数据管理
  • 工作空间与功能包
  • 解读66页数字化转型数据中台规划应用实践解决方案【附全文阅读】
  • Q/DR/CX7.2-2020 是中国企业标准体系中
  • 【2025CVPR-目标检测方向】UniMamba:基于激光雷达的3D目标检测,采用分组高效曼巴语进行统一空间信道表示学习
  • Qt + windows+exe+msvc打包教程
  • 今日科技热点 | 量子计算突破、AI芯片与5G加速行业变革
  • Elasticsearch:什么是神经网络?
  • 算法训练营day59 图论⑨ dijkstra(堆优化版)精讲、Bellman_ford 算法精讲
  • Redis Set 类型详解:从基础命令到实战应用
  • OpenJDK 17 安全点检查机制深入解析
  • 【AI基础:神经网络】16、神经网络的生理学根基:从人脑结构到AI架构,揭秘道法自然的智能密码
  • Photoshop CS6精简版轻量级,Photoshop CS6绿色免安装,Photoshop CS6安装教程
  • Kafka 概念与概述
  • AI热点周报(8.17~8.23):Pixel 10“AI周”、DeepSeek V3.1发布,英伟达再起波澜?
  • Kafka Streams vs Apache Flink vs Apache Storm: 实时流处理方案对比与选型建议