filesystem

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: MIT Imports: 17 Imported by: 116

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type System

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

func NewLocal

func NewLocal(dirPath string) (*System, error)

NewLocal initializes a new local filesystem instance.

NB! Make sure to call `Close()` after you are done working with it.

func NewS3

func NewS3(
	bucketName string,
	region string,
	endpoint string,
	accessKey string,
	secretKey string,
) (*System, error)

NewS3 initializes an S3 filesystem instance.

NB! Make sure to call `Close()` after you are done working with it.

func (*System) Attributes

func (s *System) Attributes(fileKey string) (*blob.Attributes, error)

Attributes returns the attributes for the file with fileKey path.

func (*System) Close

func (s *System) Close() error

Close releases any resources used for the related filesystem.

func (*System) CreateThumb

func (s *System) CreateThumb(originalKey string, thumbKey, thumbSize string, cropCenter bool) error

CreateThumb creates a new thumb image for the file at originalKey location. The new thumb file is stored at thumbKey location.

thumbSize is in the format "WxH", eg. "100x50".

func (*System) Delete

func (s *System) Delete(fileKey string) error

Delete deletes stored file at fileKey location.

func (*System) DeletePrefix

func (s *System) DeletePrefix(prefix string) []error

DeletePrefix deletes everything starting with the specified prefix.

func (*System) Exists

func (s *System) Exists(fileKey string) (bool, error)

Exists checks if file with fileKey path exists or not.

func (*System) Serve

func (s *System) Serve(response http.ResponseWriter, fileKey string, name string) error

Serve serves the file at fileKey location to an HTTP response.

func (*System) Upload

func (s *System) Upload(content []byte, fileKey string) error

Upload writes content into the fileKey location.

Jump to

Keyboard shortcuts

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