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

gofs

module
v0.2.4 Latest Latest
Warning

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

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

README

gofs

A lightweight, fast HTTP file server written in Go.

Go Report Card License Docker Pulls

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

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
  • GOFS_LOG_LEVEL (debug/info/warn/error), GOFS_ENV (production for JSON logs)

Requirements

Go 1.24+

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