workingpathfs

package
v0.0.0-...-9a67539 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

FS restricts all operations to a given path within an Fs. The given file name to the operations on this Fs will be prepended with the base path before calling the base Fs. Any file name (after filepath.Clean()) outside this base path will be treated as non existing file.

Note that it does not clean the error messages on return, so you may reveal the real path on errors.

func New

func New(source fs.FS, path string) *FS

func (*FS) Chmod

func (b *FS) Chmod(name string, mode fs.FileMode) (err error)

func (*FS) Chown

func (b *FS) Chown(name string, uid, gid int) (err error)

func (*FS) Chtimes

func (b *FS) Chtimes(name string, atime, mtime time.Time) (err error)

func (*FS) Create

func (b *FS) Create(name string) (f fs.File, err error)

func (*FS) Mkdir

func (b *FS) Mkdir(name string, mode fs.FileMode) (err error)

func (*FS) MkdirAll

func (b *FS) MkdirAll(name string, mode fs.FileMode) (err error)

func (*FS) Open

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

func (*FS) OpenFile

func (b *FS) OpenFile(name string, flag int, mode fs.FileMode) (f fs.File, err error)

func (*FS) RealPath

func (b *FS) RealPath(name string) (path string, err error)

on a file outside the base path it returns the given file name and an error, else the given file with the base path prepended

func (*FS) Remove

func (b *FS) Remove(name string) (err error)

func (*FS) RemoveAll

func (b *FS) RemoveAll(name string) (err error)

func (*FS) Rename

func (b *FS) Rename(oldname, newname string) (err error)

func (*FS) Stat

func (b *FS) Stat(name string) (fi fs.FileInfo, err error)

Jump to

Keyboard shortcuts

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