fs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AferoFileTreeReader

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

AferoFileTreeReader provides a primitive API to read directory and it's files, without caring about underlying filesystem and it's structure.

func NewAferoFileTreeReader

func NewAferoFileTreeReader(fs afero.Fs, base string) AferoFileTreeReader

NewAferoFileTreeReader returns a new reader for specified path.

func (AferoFileTreeReader) ReadFile

func (r AferoFileTreeReader) ReadFile(filename string) ([]byte, error)

ReadFile reads the file from file tree named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.

func (AferoFileTreeReader) Walk

func (r AferoFileTreeReader) Walk(walkFn func(filepath string, isDir bool, err error) error) error

Walk walks the file tree, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.

Jump to

Keyboard shortcuts

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