go-static
A simple file server that runs locally on your PC, written in Go.
Running
To run go-static, you can download binary for your system in Releases page. But you can also install latest build by running:
go install github.com/ref-err/go-static@latest
Usage
Command-line arguments:
--port=PORT: Server HTTP port (default: 8080)
--root="path/to/dir": Serve files from this directory (default: current directory)
--version: Prints version of go-static
--open: Opens file server in default browser
Example
go-static --port=3000 --root="$HOME/public"
This command runs a file server at port 3000 and a root directory public in the user's home.
Building
To build this program, you can run:
go build -o "build/go-static"
To build AND run:
go run . <go-static args> # (for example: --port=3000 --root="$HOME")
To build for other OS and other architecture:
GOOS=windows GOARCH=amd64 go build -o "build/go-static.exe"
License
This program is licensed under the MIT License.