s3uploader

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 17 Imported by: 0

README

s3uploader

Go client library to easily upload files to an s3 bucket from sources such as base64 string, Multipart File Header, Reader interface.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(c ClientConfig) (*Client, error)

func (*Client) Upload

func (c *Client) Upload(p UploadPayload) (string, error)

Uploads data from provided upload payload and then returns the object key.

func (*Client) UploadBase64

func (c *Client) UploadBase64(b64File string) (string, error)

Decodes the provided base64 string and uploads it to s3 and then returns the object key.

func (*Client) UploadFromReader

func (c *Client) UploadFromReader(data io.Reader, fileName string, contentType *string) (string, error)

Uploads data from provided reader and then returns the object key.

func (*Client) UploadMultipartFile

func (c *Client) UploadMultipartFile(h *multipart.FileHeader) (string, error)

Uploads data from provided reader and then returns the object key.

type ClientConfig

type ClientConfig struct {
	AwsAccessKeyID     string
	AwsSecretAccessKey string
	AwsRegion          string

	Bucket        string
	BaseDirectory string
}

type UploadPayload

type UploadPayload struct {
	File        io.Reader
	Filename    string
	ContentType string
}

Jump to

Keyboard shortcuts

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