s3helper

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Client  *s3.S3
	Session *session.Session
}

S3Client ...

func NewS3Client

func NewS3Client(region string) *Client

NewS3Client ... ctor region is the region of the bucket you want to access leave it blank to use AWS_REGION environment variable

func NewS3ClientWithSession

func NewS3ClientWithSession(sess *session.Session) *Client

NewS3ClientWithSession ... ctor

func (Client) GetBytes

func (c Client) GetBytes(bucket string, key string) ([]byte, error)

GetObject returns the content of a file as bytes

func (Client) ListBucket

func (c Client) ListBucket(bucket string) ([]string, error)

ListBucket list all files in a bucket

func (Client) ListBucketDir

func (c Client) ListBucketDir(bucket, key string) ([]string, error)

ListBucketDir list all files in a bucket and supports a prefix if you want to list file of s3://mybucket/20111117/data you must call ListBucketDir("mybucket", "20111117/data")

func (Client) PutBytes

func (c Client) PutBytes(bucket string, key string, contentType string, body []byte) error

GetObject uploads bytes to given bucket and key

Jump to

Keyboard shortcuts

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