Documentation ¶
Index ¶
- Variables
- func IsText[T string | []byte](data T) bool
- func IsTextReader(r io.Reader) bool
- func PrintRoot(w io.Writer, root *FSDirectory) int
- func PrintRootFn(w io.Writer, root *FSDirectory, indentString string, ...) int
- type Directory
- type FSDirectory
- func (d *FSDirectory) AddDirectory(dirPath string)
- func (d *FSDirectory) AddFile(filePath string, reader io.ReadCloser) *FSFile
- func (d *FSDirectory) Find(path []string) (FileLike, error)
- func (d *FSDirectory) FindWithParent(path []string) (*FSDirectory, FileLike, error)
- func (d *FSDirectory) ForEach(fn func(FileLike) (cancel bool, err error)) (cancel bool, err error)
- func (d *FSDirectory) GetName() string
- func (d *FSDirectory) GetPath() string
- func (f *FSDirectory) IsDir() bool
- func (d *FSDirectory) Load() error
- func (d *FSDirectory) Root() *FSDirectory
- func (d *FSDirectory) String() string
- type FSFile
- type File
- type FileLike
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrFileLikeExcluded = errors.New("file like object was excluded")
)
Functions ¶
func IsTextReader ¶ added in v2.2.7
func PrintRootFn ¶
Types ¶
type Directory ¶
type Directory interface { FileLike Find(path []string) (FileLike, error) ForEach(func(FileLike) (cancel bool, err error)) (cancel bool, err error) Load() error }
func NewDirectory ¶
NewFSDirectory creates a new FSDirectory.
type FSDirectory ¶
type FSDirectory struct { // Name of the directory. Name string // Path of the directory. Path string // Files in the directory. Files map[string]File // Directories in the directory. Directories map[string]*FSDirectory // IsExcluded returns true if the directory is excluded. // It should only be set on the root directory. IsExcluded func(FileLike) bool // contains filtered or unexported fields }
func NewFSDirectory ¶
func NewFSDirectory(name, dirPath string, root *FSDirectory) *FSDirectory
func (*FSDirectory) AddDirectory ¶
func (d *FSDirectory) AddDirectory(dirPath string)
func (*FSDirectory) AddFile ¶
func (d *FSDirectory) AddFile(filePath string, reader io.ReadCloser) *FSFile
func (*FSDirectory) FindWithParent ¶ added in v2.2.7
func (d *FSDirectory) FindWithParent(path []string) (*FSDirectory, FileLike, error)
func (*FSDirectory) GetName ¶
func (d *FSDirectory) GetName() string
func (*FSDirectory) GetPath ¶
func (d *FSDirectory) GetPath() string
func (*FSDirectory) IsDir ¶
func (f *FSDirectory) IsDir() bool
func (*FSDirectory) Load ¶
func (d *FSDirectory) Load() error
func (*FSDirectory) Root ¶
func (d *FSDirectory) Root() *FSDirectory
Root returns the root directory.
func (*FSDirectory) String ¶
func (d *FSDirectory) String() string
String returns the directory in string format.
type FSFile ¶
type FSFile struct { // Name of the file. Name string // Path of the file. Path string // If the file is all valid utf-8 text. IsText bool Reader io.ReadCloser }
Click to show internal directories.
Click to hide internal directories.