s3

package
v0.0.0-...-356e89f Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2016 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package s3 provides a number of S3 helper functions.

For example,

// Get the filename from the key.
filename := s3.ParseFilenameFromKey(key)

// Create the file.
file, err := os.Create(filename)
if err != nil {
	panic(err)
}
defer file.Close()

// Download the data.
err = s3.Download(file, bucket, key)
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(file *os.File, bucket, key string) error

Download downloads a file from S3.

This is merely a wrapper around the aws-sdk-go downloader. It allows us to isolate the aws-sdk-go dependencies and unify error handling.

func ParseFilenameFromKey

func ParseFilenameFromKey(key string) string

ParseFilenameFromKey parses the S3 filename from the key.

This would typically be used prior to s3.Download or s3.Upload to create the required *os.File.

func Upload

func Upload(file *os.File, bucket, key string) error

Upload uploads a file to S3.

This is merely a wrapper around the aws-sdk-go uploader. It allows us to isolate the aws-sdk-go dependencies and unify error handling.

Types

type Bucket

type Bucket struct {
	Bucket string `json:"bucket,omitempty"`
	Key    string `json:"key,omitempty"`
}

Bucket defines the expected JSON structure for S3 buckets. An S3 bucket can be used for source (input) and destination (output) files.

Jump to

Keyboard shortcuts

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