Node.js快速文件服务器(HTTP上的静态文件)

问题描述:

是否有Node.js随时可用的工具(使用 npm 安装),这有助于我将文件夹内容作为文件服务器通过HTTP公开。

Is there Node.js ready-to-use tool (installed with npm), that would help me expose folder content as file server over HTTP.

示例,如果我有

D:\Folder\file.zip
D:\Folder\file2.html
D:\Folder\folder\file-in-folder.jpg

然后从开始:D:\Folder \ node node-file-server。 js
我可以通过

Then starting in D:\Folder\ node node-file-server.js I could access file via

http://hostname/file.zip
http://hostname/file2.html
http://hostname/folder/file-in-folder.jpg

为什么我的节点静态文件服务器丢弃请求?
引用一些神秘的

Why is my node static file server dropping requests? reference some mystical


标准node.js静态文件服务器

standard node.js static file server

如果没有这样的工具,我应该使用什么框架e?

If there's no such tool, what framework should I use?

相关:
NodeJS中的基本静态文件服务器

一个好的随时可用的工具选项可以是http-server:

A good "ready-to-use tool" option could be http-server:

npm install http-server -g

使用它:

cd D:\Folder
http-server

或者,像这样:

http-server D:\Folder

查看: https://github.com/nodeapps/http-server