s3file

package module
v0.0.0-...-a6ae34a Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 9 Imported by: 0

README

s3file

Go Report Card

The s3file package is a heler package to the official aws-go-sdk. It will make it easier to

  • Upload files to S3 (using multi-part upload)
  • Download files from S3
  • Checking if a file exists on S3
  • Deleting a file on S3

Function

GetFile
GetFile takes a *FileRequest c and tries to download the requested file from s3.
It returns the content of the requested file as a string and any download / read errors.
RemoveFile
RemoveFile takes a *FileRequest c and tries to remove the requested file from s3.
It returns any errors that might occure.
FileExists
FileExists takes a *FileRequest c and checks if the requested file exists or not.
It returns true if the file exists.
PutFile
PutFile takes an *PutFileRequest c and tries to send the requested file to s3.
It returns any file upload errors.

Types

PutFileRequest
type PutFileRequest struct {
    S3Bucket    string // Bucket to upload file to
    S3Prefix    string // Prefix to use for upload
    S3Filename  string // Filename to use on S3
    LocalFile   string // Local file on filesystem (whole path)
    PartSize    int64  // Size of parts (multi-part upload) in bytes, will default to 1gb
    ContentType string // Set the content type, will default to text/plain; charset=utf-8
}
FileRequest
type FileRequest struct {
    S3Bucket   string // Bucket to upload file to
    S3Prefix   string // Prefix to use for upload
    S3Filename string // Filename to use on S3
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(c *FileRequest) bool

FileExists takes a *FileRequest c and checks if the requested file exists or not. It returns true if the file exists.

func GetFile

func GetFile(c *FileRequest) (string, error)

GetFile takes a *FileRequest c and tries to download the requested file from s3. It returns the content of the requested file as a string and any download / read errors.

func PutFile

func PutFile(c *PutFileRequest) error

PutFile takes an *PutFileRequest c and tries to send the requested file to s3. It returns any file upload errors.

func RemoveFile

func RemoveFile(c *FileRequest) error

RemoveFile takes a *FileRequest c and tries to remove the requested file from s3. It returns any errors that might occure.

Types

type FileRequest

type FileRequest struct {
	S3Bucket   string // Bucket to upload file to
	S3Prefix   string // Prefix to use for upload
	S3Filename string // Filename to use on S3
}

FileRequest is used by the FileExists, GetFile and RemoveFile functions. You specify the necessary parameters for the file upload.

type PutFileRequest

type PutFileRequest struct {
	S3Bucket    string // Bucket to upload file to
	S3Prefix    string // Prefix to use for upload
	S3Filename  string // Filename to use on S3
	LocalFile   string // Local file on filesystem (whole path)
	PartSize    int64  // Size of parts (multi-part upload) in bytes, will default to 1gb
	ContentType string // Set the content type, will default to text/plain; charset=utf-8
}

PutFileRequest is used by the PutFile function. You specify the necessary parameters for the file upload.

Jump to

Keyboard shortcuts

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