files

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Overview

files is a set of utility structs and methods for working with collections of files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory struct {
	Path  string
	Files []*File
	Hash  hash.Hash
}

Directory represents a collection of files and some metadata about them

func NewDirectory

func NewDirectory(path string) *Directory

NewDirectory returns a new Directory struct (it is not a mkdir equivalent)

func (*Directory) Append

func (d *Directory) Append(f *File) error

Append adds a File struct to the Directory's Files slice

func (*Directory) GetHashString

func (d *Directory) GetHashString() string

GetHashString returns the hex-encoded string representation of the Directory's Hash

func (*Directory) MarshalJSON

func (d *Directory) MarshalJSON() ([]byte, error)

MarshalJSON is a standard helper function for representing a Directory struct in JSON format

type File

type File struct {
	Stats     *stat.Stat `json:"stats"`
	StatsHash string     `json:"statshash"`
}

File represents

func NewFile

func NewFile(fullpath, relpath string, fi fs.FileInfo) (*File, error)

NewFile returns a new File struct (it is not involved in the creation of files in the filesystem)

func (*File) PopulateHash

func (f *File) PopulateHash() error

PopulateHash calculates the checksum of the JSON representation of the Stats member struct and populates the StatsHash member

Jump to

Keyboard shortcuts

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