C# 简单的 HTTP 静态文件服务 NS (Netnr.Serve)

NS (Netnr.Serve)

简单的 HTTP 静态文件服务
Simple HTTP static file serving

Start (启动)

启动逐个参数设置

--urls (default: http://*:713/):
--root (default: D:/site): #根目录,默认命令行启动位置
--index (default: index.html):
--404 (default: 404.html):
--suffix (default: .html):
--charset (default: utf-8):
--readonly (default: false): #只读则不能上传、删除
--auth (user:pass): #设置 Basic 授权访问
--headers (k1:v1||k2:v2):

静默带参启动

ns --urls http://*:713/--readonly true

List (列表)

curl http://localhost:713/ #列表,默认浏览器 FTP,curl 友好
curl http://localhost:713/-u user:pass #带授权

(iwr http://localhost:713/).content #PowerShell

Download (下载)

curl http://localhost:713//file.exe -O
curl http://localhost:713/dir/?zip #下载文件夹,不压缩打包目录并实时输出流

iwr http://localhost:713//file.exe -outfile file.exe #PowerShell

Upload (上传)

curl http://localhost:713/-T file.ext #上传文件
curl http://localhost:713/dir/rename.ext -T file.ext #自定义路径上传

iwr http://localhost:713/dir/rename.ext -method put -infile file.ext

Delete (删除)

curl http://localhost:713/file.ext -X delete #删除

iwr http://localhost:713/file.ext -method delete #PowerShell

Release (发布)

win-x64 NativeAOT 3.14M
https://r2.zme.ink/releases/ns-8.0.1-win-x64.exe

linux-x64 NativeAOT 7M
https://r2.zme.ink/releases/ns-8.0.1-linux-x64.aot

osx-x64 NativeAOT 5.25M
https://r2.zme.ink/releases/ns-8.0.1-osx-x64.aot

建议下载后改名为 ns 再配一个环境变量,更方便使用

posted @ 2024-01-27 17:48  netnr  阅读(22)  评论(0编辑  收藏  举报