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

gofs

module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: MIT

README

gofs

A lightweight, fast HTTP file server written in Go.

Go Report Card License

Features

  • Zero dependencies: Built with Go standard library only
  • Fast: Optimized for performance with minimal overhead
  • Secure: Safe path handling prevents directory traversal attacks
  • Simple: Single binary, easy deployment
  • Cross-platform: Works on Linux, macOS, Windows

Quick Start

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

# Serve current directory on port 8000
gofs

# Serve specific directory on custom port
gofs -port 3000 -dir /path/to/files

Usage

Usage: gofs [options]

Options:
  -port int    Server port (default 8000)
  -host string Server host (default "0.0.0.0")
  -dir string  Root directory to serve (default ".")
  -help        Show help
  -version     Show version

API

The server provides both HTML and JSON responses:

  • HTML: Default browser view with file listing
  • JSON: Add Accept: application/json header for programmatic access

Development

# Clone repository
git clone https://github.com/samzong/gofs.git
cd gofs

# Build
make build

# Run tests
make test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Directories

Path Synopsis
cmd
gofs command
Package internal provides core interfaces and types for the gofs file server.
Package internal provides core interfaces and types for the gofs file server.
config
Package config provides configuration management for the gofs HTTP file server.
Package config provides configuration management for the gofs HTTP file server.
filesystem
Package filesystem provides file system abstractions for the gofs server.
Package filesystem provides file system abstractions for the gofs server.
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
Package templates provides embedded HTML templates for the gofs file server.
Package templates provides embedded HTML templates for the gofs file server.
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