gsutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package gsutil provides utility helpers for working with Google Cloud Storage. These helpers are meant to simplify some common use cases. To keep these helpers simple authentication credentials are retrieved from the standard credential resolution chain used by the storage SDK 'cloud.google.com/go/storage'.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFile

func ReadFile(ctx context.Context, url string) ([]byte, error)

ReadFile reads the contents of a file located in GCloud Storage returning a byte array with its contents or an error. The url is expected to have the following format "gs://the-bucket-name/path/to/the/file.ext". Users of this func should take care to only load objects of a known size as errors can arise if the requested object is too large.

Types

type InvalidURLError

type InvalidURLError struct {
	// URL is the Google Cloud Storage url related to the error.
	URL string

	// Err is the underlying error detailing how the url is invalid.
	Err error
}

InvalidURLError is an error type that is returned if the provided Google Cloud Storage url is invalid.

func (*InvalidURLError) Error

func (e *InvalidURLError) Error() string

Error returns a human readable error message.

type ReadError

type ReadError struct {
	// URL is the Google Cloud Storage url related to the error.
	URL string

	// Err is the underlying error that caused the read failure.
	Err error
}

ReadError is an error type that is returned when there is an error reading an object from Google Cloud Storage.

func (*ReadError) Error

func (e *ReadError) Error() string

Error returns a human readable error message.

Jump to

Keyboard shortcuts

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