Noteworthy Programming Masterpiece
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

dir-listing-server

0.1.4 • Public • Published

dir-listing-server

A webserver built for serving a fancier directory listing together with the capacity to download individual files from it.

The urge to create this came from using nginx for autoindexing files. If you've used this you know it works really well, but it creates something that looks rather ugly and is not superfriendly for a human to navigate. The goal of dir-listing-server is to create a local webserver which does the same thing as autoindex in nginx, but also makes it quite navigable and looks a bit better than just plain HTML.

We use materializecss to make everything look good and utilize express.js as a webserver. Additionally we also use react to create a server-side rendering of the index. The result is that no javascript is used (okay, it is used in like one place to go back to the previous page, but ya know) and the page can easily be crawled by both a human and a machine.

Screenshots

Desktop:

What it looks like

Mobile:

What it looks like on mobile

Deployment

Example script for deploying (includes all available parameters):

import { start } from 'dir-listing-server'
 
console.log(`Deploying index server at ${DIR_LISTING_TOP_DIRECTORY}`)
console.log(`Using port: ${DIR_LISTING_EXPOSED_PORT}`)
 
start({
    onFinish: () => {}
})
 

Deployment with Dockerfile

The included Dockerfile builds a docker image which can serve from within the container. If you want to put the index server within something like a Docker Swarm then I would suggest you add a volume to the container and serve that volume with for example

docker run --env DIR_LISTING_TOP_DIRECTORY=/root/served --volume /path/to/my/directory:/root/served -p 4455:4455 dir-listing

I personally use this with sshfs to view and browse several directories and files from the same webpage.

install

npm i dir-listing-server

Downloadsweekly downloads

102

version

0.1.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar