serve-static-files
v0.1.1
Published
Serve static files from cli
Downloads
319
Readme
Usage
Node
npm x serve-static-files <root> <options>Can also be used with npx in place of npm x
Bun
bun x --bun serve-static-files <root> <options>Can also be used with bunx in place of bun x
Deno
deno x -NESR serve-static-files <root> <options>Can also be used with dx in place of deno x
Deno HTTP
deno x -NESR https://raw.githubusercontent.com/rmhaiderali/serve-static-files/refs/heads/deno/index.js <root> <options>Default values
npm x serve-static-files . "{}"Disable index
npm x serve-static-files . "{index: false}"Set headers
npm x serve-static-files . '{setHeaders: (res) => res.setHeader("powered-by", "serve-static-files")}'Environment Variables:
| Variable | Purpose | | ----------- | ---------------------------------------- | | HOST | Network interface to listen on | | PORT | Port number to listen on | | BASE | Base path for the served files | | DIR_LISTING | Display directory content, true or false |
Arguments:
| Options | Discription | Type | Default |
| ------- | --------------------------- | --------------------------- | --------------------- |
| root | directory to serve | string | "." |
| options | serve-static options object | serve-static options | '{dotfiles: "allow"}' |
Refresh cached package
Node (Entire npm cache)
npm cache clean --forceBun (Entire bun cache)
bun pm cache cleanDeno
deno x -r -NESR serve-static-filesDeno HTTP
deno x -r -NESR https://raw.githubusercontent.com/rmhaiderali/serve-static-files/refs/heads/deno/index.js <root> <options>Deno Permissions
When using deno -NERS grants minimum required permissions. You can also use -A to grant all permissions, but using the least required permissions is recommended to improve security. For more information on Deno permissions, please refer to the Deno manual.
License
MIT
