photo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

File represents a single source file.

func New

func New(opts ...Option) *File

New initializes a new file instance.

func (*File) Checksum

func (h *File) Checksum() (string, error)

Checksum generates a SHA256 checksum from file content.

func (*File) Copy

func (h *File) Copy(target string, byChecksum bool)

Copy simply copies the file to defined target.

func (*File) Creation

func (h *File) Creation() (time.Time, error)

Creation tries to extract the correct creation time.

func (*File) Ext

func (h *File) Ext() string

Ext tries to return a cleaned file extension.

func (*File) Move

func (h *File) Move(target string, byChecksum bool)

Move simply moves the file to defined target.

func (*File) String

func (h *File) String() string

String converts a file into a string representation.

func (*File) Valid

func (h *File) Valid() bool

Valid checks if the file got a valid extension.

type Option

type Option func(o *Options)

Option defines a single option function.

func WithInfo

func WithInfo(val os.FileInfo) Option

WithInfo provides a function to set the info option.

func WithPath

func WithPath(val string) Option

WithPath provides a function to set the path option.

type Options

type Options struct {
	Path string
	Info os.FileInfo
}

Options defines the available options for this package.

Jump to

Keyboard shortcuts

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