caddyfsarchives

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

README

caddy-fs-archives

A caddy filesystem for Caddy's file_server which allows browsing into archives supported by github.com/mholt/archives.

This is currently a direct wrapper around archives.DeepFS, and so inherits its limitations. We only go down a single level. /foo.zip can be browsed, but /foo.zip/bar.zip will return the bar.zip file.

The way that caddy file_server interacts with filesystems means one can't "download" the first archive file at all via a file_server using this filesystem, only browse the files inside that archive.

Usage:

Include as a module:

xcaddy build --with github.com/codyps/caddy-fs-archives

Define a filesystem instance, and reference that instance in file_server:

# Caddyfile
{
    # "my_files" is a name you pick for this filesystem.
    # "archives" is the type of filesystem, which corresponds to the module name "caddy.fs.archives".
    filesystem my_files archives {
        # path to the root of the filesystem. This is where Caddy will look for files to serve.
        root /srv/data
    }
}

localhost:8080 {
    file_server browse {
        # "my_files" is the name of the filesystem we defined above.
        fs my_files
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	fs.StatFS `json:"-"`

	Root string `json:"root_path,omitempty"`
}

FS is a Caddy virtual filesystem module for handling archive files.

func (FS) CaddyModule

func (FS) CaddyModule() caddy.ModuleInfo

func (*FS) Provision

func (fs *FS) Provision(ctx caddy.Context) error

func (*FS) UnmarshalCaddyfile

func (fs *FS) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Jump to

Keyboard shortcuts

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