metadata

package
v0.0.0-...-6871db2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AllBits = Bits(1<<NumBits) - 1
View Source
const NumBits = 5

Variables

This section is empty.

Functions

func MaybeFGet

func MaybeFGet(file *os.File, name string) ([]byte, bool)

func MaybeFSet

func MaybeFSet(file *os.File, name string, value []byte)

Types

type Bits

type Bits uint32
const (
	SizeBit Bits = (1 << iota)
	TimeBit
	MD5Bit
	SHA1Bit
	SHA256Bit
)

func (Bits) Append

func (bits Bits) Append(out []byte) []byte

func (Bits) GoAppend

func (bits Bits) GoAppend(out []byte) []byte

func (Bits) GoString

func (bits Bits) GoString() string

func (Bits) Has

func (bits Bits) Has(x Bits) bool

func (Bits) HasAll

func (bits Bits) HasAll(x Bits) bool

func (Bits) String

func (bits Bits) String() string

type MD5Sum

type MD5Sum = [md5.Size]byte

type Metadata

type Metadata struct {
	Bits   Bits
	Size   int64
	Time   int64
	MD5    MD5Sum
	SHA1   SHA1Sum
	SHA256 SHA256Sum
}

func (Metadata) Append

func (meta Metadata) Append(out []byte) []byte

func (Metadata) Check

func (meta Metadata) Check(size int64, modTime int64) bool

func (*Metadata) Compute

func (meta *Metadata) Compute(file *os.File, size int64, modTime int64) bool

func (*Metadata) Decode

func (meta *Metadata) Decode(input []byte) bool

func (*Metadata) Load

func (meta *Metadata) Load(file *os.File, names Names) bool

func (*Metadata) Reset

func (meta *Metadata) Reset()

func (Metadata) Save

func (meta Metadata) Save(file *os.File, names Names)

func (Metadata) String

func (meta Metadata) String() string

type Names

type Names struct {
	Stamp  string
	Size   string
	Time   string
	MD5    string
	SHA1   string
	SHA256 string
}

func DefaultNames

func DefaultNames() Names

type SHA1Sum

type SHA1Sum = [sha1.Size]byte

type SHA256Sum

type SHA256Sum = [sha256.Size]byte

Jump to

Keyboard shortcuts

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