s3zipper

package module
v0.0.0-...-84d54e1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2020 License: MIT Imports: 7 Imported by: 0

README

s3zipper

Go package for creating a zip archive of files on AWS S3 and upload the zip archive file to S3.

No disk space is used for this operation as the files are archived and piped directly to the zip archive file on S3 through a buffer. The full file is not stored in memory but is instead buffered to allow the application to run in limied memory environments.

Example

package main

import (
	"github.com/alanihre/s3zipper"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
)

func main() {
	region := "eu-north-1"

	// Create a new AWS session. Credentials stored in environment variables
	sess, err := session.NewSession(&aws.Config{
		Region: aws.String(region),
	})
	if err != nil {
		panic(err)
	}

	inputBucket := "my-s3-bucket"
	files := []string{"file1.txt", "file2.txt"}
	archiveBucket := "my-s3-bucket"
	archiveFileName := "archive.zip"

	err = s3zipper.S3Zip(sess, inputBucket, files, archiveBucket, archiveFileName)
	if err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func S3Zip

func S3Zip(sess *session.Session, inputBucket string, files []string, archiveBucket string, archiveFileName string) error

Types

type SerialWriterAt

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

func (SerialWriterAt) WriteAt

func (fw SerialWriterAt) WriteAt(p []byte, offset int64) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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