Node.js quick file server (static files over HTTP)

Paul Verest picture Paul Verest · May 2, 2013 · Viewed 536.6k times · Source

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

Example, if I have

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

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

standard node.js static file server

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

Related: Basic static file server in NodeJS

Answer

Matt Self picture Matt Self · May 3, 2013

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

npm install http-server -g

To use it:

cd D:\Folder
http-server

Or, like this:

http-server D:\Folder

Check it out: https://github.com/nodeapps/http-server