filterfs

package
v1.5.48 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirFile

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

A ReadDirFile wrapper for fs.File

func (*DirFile) Close

func (d *DirFile) Close() error

func (*DirFile) Read

func (d *DirFile) Read(_ []byte) (int, error)

func (*DirFile) ReadDir

func (d *DirFile) ReadDir(n int) ([]fs.DirEntry, error)

func (*DirFile) Stat

func (d *DirFile) Stat() (fs.FileInfo, error)

type FS

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

FS wraps an fs.FS and hides inaccessible files and directories by returning appropriate "not found" errors or filtering them from listings.

func New

func New(fsys fs.FS) *FS

New creates a new FS wrapper around the provided filesystem.

func (*FS) Open

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

Open opens the named file for reading and if file is a directory wraps it with a ReadFileDir instance that filters out access errors

func (*FS) ReadDir

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

ReadDir reads and returns directory entries, filtering out inaccessible items.

Jump to

Keyboard shortcuts

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