This section is empty.


This section is empty.


This section is empty.


type Dir

type Dir struct {
	Files map[string]*FileInfo
	Dirs  map[string]*Dir

    Dir is a container for other Dirs and FileInfo structs

    func Load

    func Load(ctx context.Context, filename string) (dir *Dir, err error)

      Load returns a Dir struct loaded from a file

      func New

      func New() *Dir

        New returns a new Dir struct

        func (*Dir) Del

        func (d *Dir) Del(path string)

          Del deletes the FileInfo stored at path, if it exists.

          func (*Dir) Get

          func (d *Dir) Get(path string) *FileInfo

            Get returns the FileInfo at the given path. If it doesn't exist, it returns nil

            func (*Dir) GetAllPaths

            func (d *Dir) GetAllPaths(ctx context.Context) <-chan string

              GetAllPaths returns a channel that will be populated with every path within the Directory The channel will be closed after all paths have been written.

              func (*Dir) MatchOsInfo

              func (d *Dir) MatchOsInfo(path string, info os.FileInfo) bool

                MatchOsInfo checks whether the given path in the Directory matches the file info in the provided os.FileInfo. true is returned if the path exists and it matches the Size, ModTime and Mode of the provided os.FileInfo Otherwise, false is returned.

                func (*Dir) Put

                func (d *Dir) Put(path string, f *FileInfo)

                  Put stores the FileInfo at the given path

                  func (*Dir) Save

                  func (d *Dir) Save(ctx context.Context, filename string) error

                    Save serializes the Directory struct to a file. The Directory data can be recovered using the Load function.

                    type FileInfo

                    type FileInfo struct {
                    	Size    int64
                    	ModTime time.Time
                    	Mode    os.FileMode

                      FileInfo contains metadata about a file

                      Source Files