chustorage

package
v0.0.0-...-3521f82 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 4 Imported by: 0

README

chustorage

chustorage provides friendlier APIs to perform download and upload in GCS

How to use

// upload
r, err := os.Open(filename)
err = chustorageWrapper.UploadFile(ctx, bucket, object, r)

// download
f, err := os.Create(filename)
err = chustorageWrapper.DownloadFile(ctx, bucket, object, f)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chustorage

type Chustorage struct {
	Storage *storage.Client
}

Chustorage - Google Cloud Storage (GCS) wrapper

func (*Chustorage) DeleteFile

func (chustorage *Chustorage) DeleteFile(ctx context.Context, bucket, bucketFilename string) error

DeleteFile - Delete file from storage.

func (*Chustorage) DownloadFile

func (chustorage *Chustorage) DownloadFile(ctx context.Context, bucket, bucketFilename string, fileWriter io.Writer) error

DownloadFile - Download file from storage.

func (*Chustorage) ReadFile

func (chustorage *Chustorage) ReadFile(ctx context.Context, bucket, bucketFilename string) ([]byte, error)

ReadFile - Read file from storage as raw bytes.

func (*Chustorage) UploadFile

func (chustorage *Chustorage) UploadFile(ctx context.Context, bucket, bucketFilename string, fileReader io.Reader) error

UploadFile - Upload file to storage.

Jump to

Keyboard shortcuts

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