Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fileserver/README.md

A file-server command.
Go to Latest
File

file-server

An on the go file-server to get you quickøy started on a front-end.

Features

  • TLS
  • Custom index files.
  • Browse files.
  • Embedded-JavaScript
  • Built-in TypeScript compilation.
  • CORS on demand.
  • Caching.

Installation

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

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