s3

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package s3 this package in intention to hide aws s3 storage implementation under the interface that will give you the ability to user other cloud providers in the future

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

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

FileInfo struct to get file information

func (FileInfo) Size

func (fi FileInfo) Size() int64

Size get file size

type Storage

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

Storage interface adaptation for s3

func NewStorage

func NewStorage(ses *session.Session, bucket string) *Storage

NewStorage create new storage instance

func (*Storage) Create

func (s *Storage) Create(path string) (io.ReadWriteCloser, error)

Create for create interface

func (*Storage) Delete

func (s *Storage) Delete(path string) error

Delete remove object from s3

func (*Storage) Get

func (s *Storage) Get(path string) (io.ReadCloser, error)

Get file from s3 bucket

func (s *Storage) Link(path string, expire time.Duration) (string, error)

Link generate expiration link for s3 access

func (*Storage) List

func (s *Storage) List(path string) ([]string, error)

List reads the path content Note: it is not better performant than Walk because it still itterates over all objects in a path

func (*Storage) Put

func (s *Storage) Put(path string, body io.Reader) error

Put file into s3 bucket

func (*Storage) Stat

func (s *Storage) Stat(path string) (storage.FileInfo, error)

Stat get object info

func (*Storage) Walk

func (s *Storage) Walk(path string, callback func(path string)) error

Walk recursively look for files in directory

Jump to

Keyboard shortcuts

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