| 912 | } |
| 913 | |
| 914 | function printUsage() { |
| 915 | // deno-lint-ignore no-console |
| 916 | console.log(`Deno File Server ${denoConfig.version} |
| 917 | Serves a local directory in HTTP. |
| 918 | |
| 919 | INSTALL: |
| 920 | deno install --allow-net --allow-read --allow-sys jsr:@std/http@${denoConfig.version}/file-server |
| 921 | |
| 922 | USAGE: |
| 923 | file_server [path] [options] |
| 924 | |
| 925 | OPTIONS: |
| 926 | -h, --help Prints help information |
| 927 | -p, --port <PORT> Set port (default is 8000) |
| 928 | --cors Enable CORS via the "Access-Control-Allow-Origin" header |
| 929 | --host <HOST> Hostname (default is 0.0.0.0) |
| 930 | -c, --cert <FILE> TLS certificate file (enables TLS) |
| 931 | -k, --key <FILE> TLS key file (enables TLS) |
| 932 | -H, --header <HEADER> Sets a header on every request. |
| 933 | (e.g. --header "Cache-Control: no-cache") |
| 934 | This option can be specified multiple times. |
| 935 | --no-dir-listing Disable directory listing |
| 936 | --no-dotfiles Do not show dotfiles |
| 937 | --no-cors Disable cross-origin resource sharing |
| 938 | -v, --verbose Print request level logs |
| 939 | -V, --version Print version information |
| 940 | |
| 941 | All TLS options are required when one is provided.`); |
| 942 | } |
| 943 | |
| 944 | if (import.meta.main) { |
| 945 | main(); |