Help us shape the future of Go! Take the 2026 Go Developer Survey

gofs

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT

README

gofs

A lightweight, fast HTTP file server written in Go.

Stars Go Report Card Version Docker Pulls Downloads License Ask DeepWiki

Why

  • Fast and safe: secure path handling, optional Basic Auth (bcrypt)
  • Simple: one binary, zero config to start
  • Modern UI: advanced theme with upload, folder creation, and ZIP downloads
  • WebDAV: optional /dav/ endpoint (read-only)
  • Production‑ready: structured logs, health probes, graceful shutdown
  • Multiple directories: mount multiple paths with optional read-only flags

NEXT? (Wishing Pool)

These will increase little by little until v1 in my goal. Any feedback is welcome.

  • HTTP/2 support, TLS/HTTPS
  • Full text search, file preview
  • S3 storage support, OAuth integration
  • Prometheus metrics
  • Plug-in system
  • SDK
  • Kubernetes Operator
  • Multi-tenancy
  • Audit logging
  • WebSocket real-time notifications

Install

Homebrew

brew install samzong/tap/gofs

CLI

go install github.com/samzong/gofs/cmd/gofs@latest

Quick start

# Serve current directory at http://127.0.0.1:8000
gofs

# Change host/port
gofs -host 0.0.0.0 -port 3000

# Let the operating system select an available port (shown in startup logs)
gofs -port 0

# Enable auth
gofs -auth user:password

# Modern UI (upload, create folder)
gofs --theme advanced

# WebDAV on /dav (read‑only by default)
gofs --enable-webdav

Mounts

You can expose one or more directories. Format: [path:]dir[:ro][:name]

# Single dir (default is ".")
gofs -d /srv/files

# Multiple mounts with names and read‑only flags
gofs -d "/data:/srv:ro:Data" -d "/logs:/var/log::Logs"

JSON API

Every listing can be JSON by sending: Accept: application/json

curl -H "Accept: application/json" http://localhost:8000/

Health checks

  • HTTP: /healthz and /readyz (200 OK)
  • CLI: gofs --health-check

Environments

Flags have GOFS_* env twins (flags win):

  • GOFS_PORT, GOFS_HOST, GOFS_DIR (semicolon‑separated for multiple)
  • GOFS_THEME, GOFS_SHOW_HIDDEN, GOFS_AUTH, GOFS_ENABLE_WEBDAV
  • GOFS_LOG_LEVEL (debug/info/warn/error), GOFS_ENV (production for JSON logs)

Examples

See examples for Docker and Kubernetes manifests.

License

MIT. See LICENSE.

Directories

Path Synopsis
cmd
gofs command
handler/templates/themes
Package themes provides the advanced theme for GoFS
Package themes provides the advanced theme for GoFS
server
Package server provides HTTP server implementation for the gofs file server.
Package server provides HTTP server implementation for the gofs file server.
pkg
fileutil
Package fileutil provides MIME type detection and file type utilities.
Package fileutil provides MIME type detection and file type utilities.
httprange
Package httprange implements HTTP Range request parsing and response handling according to RFC 7233.
Package httprange implements HTTP Range request parsing and response handling according to RFC 7233.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL