Skip to content

CLI Examples

This page show Static CLI command usage

Start Command

CommandDescription
static startStart local server
static stopStop local server
static restartRestart local server
static statusShow server status

Flags

Flagsdetails
-h or --helpInfo of all commands and usage
-v or --versionPrint static-cli version
-p or --portstart server on specific port
--spaIf file not found instead of 404 status code it will send html file in response.
--gzipThis mode sending gzip encoded file and folder for fast file transfer
--guiIt provides you web gui interface of you file system access : http://localhost:3000/__dashboard
--includesInclude file/folder using (glob) pattern. Multiple patterns separated by ";" ALSO path must inside quotes ""
Example: "src/**/*.js;assets/**/*.css"
--excludesExcludes file/folder using (glob) pattern. Multiple patterns separated by ";" ALSO path must inside quotes ""
Example: "node_modules/**;dist/**"
--open or --browseOpen url in browser
--allowed-createIt provide to create a file
--allowed-renameIt provide to rename a file
--allowed-deleteIt provide to delete a file
--allowed-updateIt provide to update a file

Usage

Gui Mode

bash
static start --gui

Instant open in browser use --open or --browse flag

bash
static start --gui --open

Public Mode
prerequisite: install cloudflared tunnel see installation
Available for - mac | linux | windows

bash
static start --public --open

It Provides you a public url which connect your local server to internet


Includes Or Excludes
To include or exclude specific file or folder use these Flags using Glob-Pattern

bash
static start --excludes "*.txt"
static start --includes "**/*.mk4"

INFO

  • By default server send index.html file on slash / if found otherwise not-found with 404 status code.

  • Our Server always send file with "Content-Disposition" with "attachment" that's mean if you request from client side like Browser then it will automatically downloaded or Browser asked you to where to save file
    If you want browser show your file then you can add ?show=true in query like http://localhost:3000/bhola.mp4?show=true then your file load in browser if your file is renderable otherwise it would be downloaded


To List all files in specific Directory append /ls at end of path

bash
curl http://localhost:3000/folder/ls

To see stat of file add info=true in query

bash
curl http://localhost:3000/folder?info=true

Crud

Create
curl http://localhost:3000/file.txt?create=true
Rename
curl http://localhost:3000/folder?rename=new-folder
Update
curl http://localhost:3000/index.html?update=true
Delete
curl http://localhost:3000/folder?delete=true