scan

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(c io.Closer)

Close wraps io.Closer Close func with error handling

func Scan

func Scan(path string, fs afero.Fs, handlers ...Handler)

Scan do specified path scanning and executes folder handler on each folder and all file handlers on each file

Types

type FileEntry

type FileEntry struct {
	// File size in bytes
	Size int64

	// Full path
	Path string
}

FileEntry represent file description

type FolderEntry

type FolderEntry struct {
	FileEntry

	// The number of files in a folder
	Count int64
}

FolderEntry represent folder description

type Handler

type Handler interface {
	// Handle handles filesystem event
	Handle(evt *ScanEvent)
}

Handler defines scanning handler interface that handles filesystem events

type ScanEvent

type ScanEvent 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
}

ScanEvent defines scanning event structure that can contain file or folder event information

Jump to

Keyboard shortcuts

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