sirv-go
v0.1.1
Published
A fast, standalone static file server
Readme
sirv-go
A native Go port of sirv-cli,
the command-line static file server—not the
sirv Node.js middleware API.
npx sirv-go publicYou can also use bunx sirv-go public. After installing the package,
use sirv-go public in package scripts or as a global command. The executable
is named sirv-go so it can coexist with upstream's sirv command.
This single package contains a small Node.js launcher and six native binaries for macOS, Linux, and Windows on x64 and arm64. The launcher selects the binary for your platform. Every installation downloads all six binaries; no optional packages, install-time downloads, or compilation are needed.
Use it to serve a directory from the terminal, as you would with sirv-cli.
This CLI-only package cannot replace import sirv from 'sirv' in an application.
Common commands
npx sirv-go public --dev # Read changing files on each request
npx sirv-go dist --single # SPA preview
npx sirv-go dist --port 3000 --strict-port # Fail if port 3000 is occupied
npx sirv-go public --host # Network sharing, no authentication
npx sirv-go --help # All options and examplesThe directory defaults to . and the address to http://localhost:8080.
Nonempty HOST and PORT environment variables override flags. An occupied
port normally falls back to an available port; use --strict-port to fail
instead. Port 0 explicitly chooses an available port even in strict mode.
Startup output shows the actual bind address and warns when listening beyond
localhost. Serve only a dedicated public directory: this server has no
authentication. --no-logs hides request logs but keeps startup information;
--quiet hides both, without suppressing errors.
Missing bundled binary
If the bundled binary is missing, reinstall the package:
npm install sirv-go
# For a global installation:
npm install --global sirv-goFor development, SIRV_BINARY_PATH can select a local native executable.
