s3stream

package module
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 9 Imported by: 0

README

Go Report Card GoDoc

s3stream

What is it?

Streaming client for Amazon AWS S3

Golang library that allows Get and Put operations from/to Amazon S3 in streaming fashion.

How to install

go get github.com/indiependente/s3stream

Usage

Get:

rc, err := store.Get(prefix, bucketname, filename)

rc is an io.ReadCloser which you can stream from.

Put:

n, err := store.Put(prefix, bucketname, filename, r)

r is an io.Reader and Put will stream its content to the specified file in the desired bucket.

Look at the tests for more info on its usage.

You can run the tests locally by using Minio (https://github.com/minio/minio). Example:

docker run --rm --name minio -e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \
  -e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" -p 9000:9000 \
  -d minio/minio server /data
  
go test ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is the S3 implementation of the Store interface.

func NewStore

func NewStore(conf *aws.Config) Store

NewStore returns a Store given the input options.

func NewStoreWithClient

func NewStoreWithClient(client s3iface.S3API) Store

NewStoreWithClient returns a Store given the input client.

func (Store) Get

func (s Store) Get(prefix, bucketname, filename string) (io.ReadCloser, error)

Get returns the content of the file in input reading it from the underlying S3 bucket.

func (Store) Put

func (s Store) Put(prefix, bucketname, filename string, r io.Reader) (int, error)

Put stores the content of the reader in input with the specified name. Returns number of bytes written and an error if any.

Jump to

Keyboard shortcuts

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