filestorage

package
v1.4.16 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 11 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
	Expiration      time.Duration
	// contains filtered or unexported fields
}

FileStorage File Storage implements imagor.Storage interface

func New

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

New creates FileStorage

func (*FileStorage) Delete added in v0.9.6

func (s *FileStorage) Delete(_ context.Context, image string) error

Delete implements imagor.Storage interface

func (*FileStorage) Get added in v0.8.23

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

Get implements imagor.Storage interface

func (*FileStorage) Path

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

Path transforms and validates image key for storage path

func (*FileStorage) Put added in v0.8.23

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

Put implements imagor.Storage interface

func (*FileStorage) Stat added in v0.8.23

func (s *FileStorage) Stat(_ context.Context, image string) (stat *imagor.Stat, err error)

Stat implements imagor.Storage interface

type Option

type Option func(h *FileStorage)

Option FileStorage option

func WithBlacklist

func WithBlacklist(blacklist *regexp.Regexp) Option

WithBlacklist with regexp path blacklist option

func WithExpiration added in v0.8.10

func WithExpiration(exp time.Duration) Option

WithExpiration with modified time expiration option

func WithMkdirPermission

func WithMkdirPermission(perm string) Option

WithMkdirPermission with mkdir permission option

func WithPathPrefix

func WithPathPrefix(prefix string) Option

WithPathPrefix with path prefix option

func WithSafeChars

func WithSafeChars(chars string) Option

WithSafeChars with safe chars option

func WithSaveErrIfExists

func WithSaveErrIfExists(saveErrIfExists bool) Option

WithSaveErrIfExists with save error if exists option

func WithWritePermission

func WithWritePermission(perm string) Option

WithWritePermission with write permission option

Jump to

Keyboard shortcuts

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