FileServer: A secure file-server with EJS & .ts,.tsx,.js,.jsx bundler, built-in caching

FileServer

https://deno.land/x/fileserver - https://github.com/ihack2712/file-server

The fileserver program is a very simple file-server that serves static files.

An on the go file-server.

Installation

deno install \
	--unstable \
	--allow-read=.,$(which deno) \
	--allow-net \
	--allow-run \
	-f \
	-n fs \
	https://deno.land/x/fileserver/cli.ts

Features

Usage

To start a file-server simply run:


fs

To start a file-server with a custom directory:


fs subdir

To start a file-server with a custom port:


fs -p 3000

To start a file-server with a custom host:


fs -H 0.0.0.0

To start a file-server with a custom port & host:


fs -H 0.0.0.0 -p 3000

To start a file-server with Embedded-JavaScript enabled:


fs -e

To start a file-server with TypeScript enabled:


fs -t

To start a file-server with Embedded-JavaScript & TpeScript enabled:


fs -et

To enable cors:


fs -C

To enable TLS (https):


fs -c ./path/to/cert.pem -k ./path/to/key.pem

To enable caching:


fs --cache

3 Likes

Wow, is it open source?

Yes! The source code is located at https://deno.land/x/fileserver. The repository is located at https://github.com/ihack2712/file-server.

1 Like

Ihack went to github? Impossible!

4 Likes

https://deno.land doesn’t support gitlab to my knowledge :stuck_out_tongue:

2 Likes

Things shouldn’t just support github, they should just support git in general

1 Like

Can we have an option for custom directory listings? Like add our own CSS, JavaScript, etc.

I like that idea! I’ll make sure to implement it in the next release that I’m currently working on!

1 Like

I totally agree, however their system works in a very specific way, it uses webhooks to be signaled of new tags. If IIRC gitlab and github doesn’t send the same webhook content. This could probably be fixed using either CI or creating custom hooks in the git folder :wink:

The next version of FileServer will be built on Texa, which is my deno web framework inspired by Oak and Express.

The new features will be:

  • Code injection (inject code onto file-server, for instance an API, websocket handling, etc).
  • Custom directory listing (suggested by @aboutDavid).

This will be a new major release because it changes how everything work, it will be a complete rewrite.

3 Likes