mountFS

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

mountFS

mountFS is a filesystem wrapper that allows mounting multiple io/fs.FS filesystems at specific paths within a single virtual root.

Features

  • Multi-mount Point: Mount different filesystem implementations at any path.
  • Unified Hierarchy: Access multiple storage systems through a single filesystem object.
  • Dynamic Mounting: Add or remove mounts at runtime.

Usage

import (
    "github.com/je4/filesystem/v3/pkg/mountFS"
)

// Initialize an empty mount filesystem
mfs := mountFS.NewFS(logger)

// Mount an OS filesystem at /local
mfs.Mount("/local", localOSFS)

// Mount an S3 bucket at /s3
mfs.Mount("/s3", s3FS)

// Access files across mounts
f, _ := mfs.Open("/local/file.txt")
f2, _ := mfs.Open("/s3/image.png")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MountFS

type MountFS struct {
	fs.FS
	// contains filtered or unexported fields
}

func NewMountFS

func NewMountFS(base fs.FS) *MountFS

func (*MountFS) Close

func (m *MountFS) Close() error

func (*MountFS) Mount

func (m *MountFS) Mount(dir string, fsys fs.FS) error

func (*MountFS) Open

func (m *MountFS) Open(name string) (fs.File, error)

func (*MountFS) ReadDir

func (m *MountFS) ReadDir(name string) ([]fs.DirEntry, error)

Jump to

Keyboard shortcuts

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