filestorage

package
Version: v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStorage

type FileStorage struct {
	BaseDir         string
	PathPrefix      string
	Blacklists      []*regexp.Regexp
	MkdirPermission os.FileMode
	WritePermission os.FileMode
	SaveErrIfExists bool
	SafeChars       string
	// contains filtered or unexported fields
}

func New

func New(baseDir string, options ...Option) *FileStorage

func (*FileStorage) Load

func (s *FileStorage) Load(_ *http.Request, image string) (*imagor.Blob, error)

func (*FileStorage) Path

func (s *FileStorage) Path(image string) (string, bool)

func (*FileStorage) Save

func (s *FileStorage) Save(_ context.Context, image string, blob *imagor.Blob) (err error)

type Option

type Option func(h *FileStorage)

func WithBlacklist

func WithBlacklist(blacklist *regexp.Regexp) Option

func WithMkdirPermission

func WithMkdirPermission(perm string) Option

func WithPathPrefix

func WithPathPrefix(prefix string) Option

func WithSafeChars

func WithSafeChars(chars string) Option

func WithSaveErrIfExists

func WithSaveErrIfExists(saveErrIfExists bool) Option

func WithWritePermission

func WithWritePermission(perm string) Option

Jump to

Keyboard shortcuts

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