files

package
v0.0.0-...-a431a9e Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package files has the filesystems a computer can be given. A mount is an afero.Fs, so anything that implements one can be a directory of the computer: memory, a database, an object store. Dir is a directory of the host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct{ *os.File }

A File is an open file or directory of a Root. Nothing it does names a path again, so it stays the file that was opened whatever happens to the name it was opened by.

func (*File) IsAppend

func (f *File) IsAppend() bool

IsAppend reports whether the system places each write at the end of the file.

func (*File) SetAppend

func (f *File) SetAppend(on bool) error

SetAppend changes the open file's own append mode, which holds also when another program appends to the file.

type Root

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

A Root is a host directory as an afero.Fs that cannot be left. Every operation goes through os.Root, which resolves a name inside the directory and refuses one that leads out of it, by "..", by a symbolic link, or by a link swapped in while the name is being walked. afero's own BasePathFs compares path prefixes, which a symbolic link defeats.

Only regular files and directories can be opened, and no symbolic link can be made.

func Dir

func Dir(path string) (*Root, error)

Dir opens the host directory at path. Close it when the computer it was given to is done.

func (*Root) Chmod

func (r *Root) Chmod(name string, mode os.FileMode) error

func (*Root) Chown

func (r *Root) Chown(name string, uid, gid int) error

func (*Root) Chtimes

func (r *Root) Chtimes(name string, atime, mtime time.Time) error

func (*Root) Close

func (r *Root) Close() error

func (*Root) Create

func (r *Root) Create(name string) (afero.File, error)
func (r *Root) Link(from, to string) error

Link makes a hard link. A link to a symbolic link is refused: some systems would link the file it points to.

func (*Root) LstatIfPossible

func (r *Root) LstatIfPossible(name string) (os.FileInfo, bool, error)

LstatIfPossible is afero's Lstater.

func (*Root) Mkdir

func (r *Root) Mkdir(name string, perm os.FileMode) error

func (*Root) MkdirAll

func (r *Root) MkdirAll(name string, perm os.FileMode) error

func (*Root) Name

func (r *Root) Name() string

func (*Root) Open

func (r *Root) Open(name string) (afero.File, error)

func (*Root) OpenFile

func (r *Root) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (*Root) ReadlinkIfPossible

func (r *Root) ReadlinkIfPossible(name string) (string, error)

ReadlinkIfPossible is afero's LinkReader.

func (*Root) Remove

func (r *Root) Remove(name string) error

func (*Root) RemoveAll

func (r *Root) RemoveAll(name string) error

func (*Root) Rename

func (r *Root) Rename(from, to string) error

func (*Root) Stat

func (r *Root) Stat(name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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