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

gofs

module
v0.2.2-test Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT

README

gofs

A lightweight, fast HTTP file server written in Go.

Go Report Card License

Why

  • Fast and safe: secure path handling, optional Basic Auth (bcrypt)
  • Simple: one binary, zero config to start
  • Modern UI: advanced theme with upload and folder creation
  • WebDAV: optional /dav/ endpoint
  • Production‑ready: structured logs, health probes
  • As sidecar: drop it next to any Pod to expose in‑container paths, Basic Auth, and optional read‑only WebDAV

Screenshot

Screenshot

Install

Homebrew

brew tap samzong/tap
brew install 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

# Enable auth
gofs -auth user:password

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

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

Mounting directories

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

Configuration

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

Requirements

Go 1.24+

Examples

See examples/ for Docker and Kubernetes manifests.

License

MIT. See LICENSE.

Directories

Path Synopsis
cmd
gofs command
handler
Package handler provides HTTP request handlers for the gofs file server.
Package handler provides HTTP request handlers for the gofs file server.
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.

Jump to

Keyboard shortcuts

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