Documentation ¶
Index ¶
- Constants
- Variables
- func AppendFile(ctx context.Context, fs FS, p string, perm os.FileMode, data []byte) error
- func DeleteFile(ctx context.Context, fs FS, p string) error
- func IsErrExist(err error) bool
- func IsErrNotExist(err error) bool
- func MkdirAll(x FS, p string, perm FileMode) error
- func PutFile(ctx context.Context, fs FS, p string, perm os.FileMode, r io.Reader) error
- func ReadFile(ctx context.Context, fs FS, p string) ([]byte, error)
- func WalkLeaves(ctx context.Context, x FS, p string, fn func(string, DirEnt) error) error
- func WalkLeavesSpan(ctx context.Context, x FS, p string, span state.Span[string], ...) error
- type DirEnt
- type ErrReadOnly
- type FS
- type File
- type FileInfo
- type FileMode
- type ReadOnly
- func (fs ReadOnly) Mkdir(p string, perm os.FileMode) error
- func (fs ReadOnly) OpenFile(p string, flags int, mode FileMode) (File, error)
- func (fs ReadOnly) Remove(p string) error
- func (fs ReadOnly) Rename(oldPath, newPath string) error
- func (fs ReadOnly) Rmdir(p string) error
- func (fs ReadOnly) Stat(p string) (FileInfo, error)
- func (fs ReadOnly) Symlink(oldp, newp string) error
Constants ¶
View Source
const ( O_RDONLY = os.O_RDONLY O_WRONLY = os.O_WRONLY O_EXCL = os.O_EXCL O_APPEND = os.O_APPEND O_CREATE = os.O_CREATE O_TRUNC = os.O_TRUNC )
View Source
const Sep = "/"
Variables ¶
View Source
var ( ErrExist = gofs.ErrExist ErrNotExist = gofs.ErrNotExist ErrClosed = gofs.ErrClosed )
Functions ¶
func AppendFile ¶
func DeleteFile ¶
DeleteFile is an idempotent delete operation. It calls remove, but does not error if the path is already gone
func IsErrExist ¶
func IsErrNotExist ¶
func WalkLeaves ¶
WalkLeaves walks fsx starting at path p, and calls fn for every non-dir file encountered. The first argument to fn will be the path of the file. The second argument to fn will be its DirEnt in its immediate parent in the walk.
Types ¶
type ErrReadOnly ¶
type ErrReadOnly struct {
Op string
}
ErrReadOnly is returns by ReadOnly when an operation would mutate the underlying filesystem
func (ErrReadOnly) Error ¶
func (e ErrReadOnly) Error() string
type FS ¶
type FS interface { OpenFile(p string, flag int, perm os.FileMode) (File, error) Mkdir(p string, perm os.FileMode) error Rmdir(p string) error Remove(p string) error Rename(oldPath, newPath string) error Stat(p string) (FileInfo, error) Symlink(target, link string) error }
func NewFiltered ¶
NewFiltered returns a filesystem with some paths filtered.
func NewPrefixed ¶
Click to show internal directories.
Click to hide internal directories.