filesystem

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSkip = errors.New("skip")

ErrSkip is used to skip an Uploadable

Functions

func NewFsUploadables

func NewFsUploadables(afs afero.Fs, filenames []string, uploadable FsUploadable) smugmug.Uploadables

NewFsUploadables returns a new instance of an Uploadables which creates Uploadable instances from files on the filesystem

Types

type FsUploadable

type FsUploadable interface {
	// Uploadable creates an Uploadable from a filesystem
	Uploadable(afero.Fs, string) (*smugmug.Uploadable, error)
	// Pre registers a PreFunc
	Pre(...PreFunc)
	// Use registers a UseFunc
	Use(...UseFunc)
}

FsUploadable creates Uploadable instances

func NewFsUploadable

func NewFsUploadable(albumKey string) (FsUploadable, error)

NewFsUploadable returns a newly instantiated FsUploadable instance

type PreFunc

type PreFunc func(fs afero.Fs, filename string) (bool, error)

PreFunc is called before the file is opened

func Extensions

func Extensions(extension ...string) PreFunc

Extensions represents the valid list of extensions to upload

type UseFunc

type UseFunc func(up *smugmug.Uploadable) error

UseFunc is called after the file is opened but before being uploaded

func Replace

func Replace(update bool, images map[string]*smugmug.Image) UseFunc

Replace will update the Uploadable's URI if the image was already uploaded If `update` is false the URI will not be updated

func Skip

func Skip(force bool, images map[string]*smugmug.Image) UseFunc

Skip checks if the Uploadable is already uploaded by comparing MD5s If `force` is true the Uploadable will be always be uploaded

Jump to

Keyboard shortcuts

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