stripprefix

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package stripprefix is a file-system abstraction layer to strip a part of the path

Index

Constants

This section is empty.

Variables

View Source
var ErrBasePathTooShort = errors.New("path needs to at least as long as its prefix")

ErrBasePathTooShort is returned when the specified path is too short

Functions

func NewStripPrefixFs

func NewStripPrefixFs(source afero.Fs, start int) afero.Fs

NewStripPrefixFs is an internal FS implementation to remove a path prefix of a path when calling the underlying FS implementation.

Types

type File

type File struct {
	afero.File
	// contains filtered or unexported fields
}

File is the afero.File implementation

func (*File) Name

func (f *File) Name() string

Name of the file

type Fs

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

Fs is a convenience afero.Fs to remove the prefix of a path

func (*Fs) Chmod

func (b *Fs) Chmod(name string, mode os.FileMode) (err error)

Chmod changes the mode of the named file to mode.

func (*Fs) Chown

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

Chown changes the mode of the named file to mode.

func (*Fs) Chtimes

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

Chtimes changes the access and modification times of the named file

func (*Fs) Create

func (b *Fs) Create(name string) (f afero.File, err error)

Create creates a file in the filesystem, returning the file and an error, if any happens.

func (*Fs) LstatIfPossible

func (b *Fs) LstatIfPossible(name string) (os.FileInfo, bool, error)

LstatIfPossible implements afero.Lstater.LstatIfPossible

func (*Fs) Mkdir

func (b *Fs) Mkdir(name string, mode os.FileMode) (err error)

Mkdir creates a directory in the filesystem, return an error if any happens.

func (*Fs) MkdirAll

func (b *Fs) MkdirAll(name string, mode os.FileMode) (err error)

MkdirAll creates a directory path and all parents that does not exist yet.

func (*Fs) Name

func (b *Fs) Name() string

Name of this FileSystem

func (*Fs) Open

func (b *Fs) Open(name string) (f afero.File, err error)

Open opens a file, returning it or an error, if any happens.

func (*Fs) OpenFile

func (b *Fs) OpenFile(name string, flag int, mode os.FileMode) (f afero.File, err error)

OpenFile opens a file using the given flags and the given mode.

func (*Fs) Remove

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

Remove removes a file identified by name, returning an error if any happens.

func (*Fs) RemoveAll

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

RemoveAll removes a directory path and any children it contains. It does not fail if the path does not exist (return nil).

func (*Fs) Rename

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

Rename renames a file.

func (*Fs) Stat

func (b *Fs) Stat(name string) (fi os.FileInfo, err error)

Stat returns a FileInfo describing the named file, or an error, if any happens.

Jump to

Keyboard shortcuts

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