Documentation
¶
Overview ¶
Package scan provides concurrent filesystem scanning code
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Scan ¶
func Scan(path string, fs Filesystem, handlers ...Handler)
Scan do specified path scanning and executes folder handler on each folder and all file handlers on each file
Example ¶
package main import "fmt" type hndl struct{} func (*hndl) Handle(*Event) { fmt.Println("from Handle") } func main() { fs := NewOsFs() Scan("/somepath", fs, &hndl{}) }
Output:
Types ¶
type Event ¶ added in v0.12.0
type Event struct { // File set not nil in case of file event occurred File *FileEntry // Folder set not nil in case of folder event occurred Folder *FolderEntry }
Event defines scanning event structure that can contain file or folder event information
type File ¶ added in v0.10.10
type File interface { io.Closer // Readdir reads the contents of the directory associated with file and // returns a slice of up to n FileInfo values, as would be returned // by Lstat, in directory order. Subsequent calls on the same file will yield // further FileInfos. // If n > 0, Readdir returns at most n FileInfo structures. In this case, if // Readdir returns an empty slice, it will return a non-nil error // explaining why. At the end of a directory, the error is io.EOF. // // If n <= 0, Readdir returns all the FileInfo from the directory in // a single slice. In this case, if Readdir succeeds (reads all // the way to the end of the directory), it returns the slice and a // nil error. If it encounters an error before the end of the // directory, Readdir returns the FileInfo read until that point // and a non-nil error. Readdir(count int) ([]os.FileInfo, error) }
File represents an open file descriptor.
type Filesystem ¶ added in v0.10.10
Filesystem represents filesystem abstraction
func NewOsFs ¶ added in v0.12.0
func NewOsFs() Filesystem
NewOsFs creates new real os backed Filesystem instance
type FolderEntry ¶
FolderEntry represent folder description
Click to show internal directories.
Click to hide internal directories.