httpfs

package
v0.0.0-...-abfce65 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

httpfs is a read-only filesystem built on top of HTTP

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileServer

func FileServer(fsys fs.FS) http.Handler

FileServer wraps http.FileServer with extra endpoints for metadata. Requests to dir paths with `?readdir` will a return JSON array of dir entries. Requests to paths with `?stat` will return a JSON object of file info. Requests to paths with `?watch` will stream file change events.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

func New

func New(baseURL string) *FS

func (*FS) Open

func (fsys *FS) Open(name string) (fs.File, error)

func (*FS) OpenFile

func (fsys *FS) OpenFile(name string, flag int, perm fs.FileMode) (fs.File, error)

func (*FS) ReadDir

func (fsys *FS) ReadDir(name string) ([]fs.DirEntry, error)

func (*FS) Stat

func (fsys *FS) Stat(name string) (fs.FileInfo, error)

func (*FS) Watch

func (fsys *FS) Watch(name string, cfg *watchfs.Config) (*watchfs.Watch, error)

Jump to

Keyboard shortcuts

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