gcp

package
v0.0.0-...-663eb47 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, component string, bucket string, path string, w io.Writer) error

Download retrieves content from a specified path in a Google Cloud Storage bucket and writes it to the provided io.Writer. It ensures the data is fetched and copied correctly, handling any errors that may arise during the operation. This function requires a context for managing the request's lifetime, the name of the bucket, the object's path within that bucket, and an io.Writer to which the data will be written. If any errors occur while setting up the reader, transferring the data, or closing the connection, they are returned.

func GetDownloadReader

func GetDownloadReader(ctx context.Context, component string, bucket string, path string, seeker bool) (io.ReadCloser, error)

GetDownloadReader creates and returns an io.ReadCloser for reading data from a specified object in a Google Cloud Storage bucket. It takes a context for managing the request's lifetime, the name of the bucket, the object's path within that bucket, and a seeker flag indicating whether seeking operations are supported. In the event of an error during reader creation, the error is returned along with a nil reader.

func GetUploadWriter

func GetUploadWriter(ctx context.Context, component string, bucket string, path string) (io.WriteCloser, error)

GetUploadWriter creates an io.WriteCloser for uploading data to a specified path within a Google Cloud Storage bucket. It takes a context, bucket name, and object path as arguments to initiate the upload process. On successful creation of the writer, it returns the writer along with any error that may have occurred during setup.

func Upload

func Upload(ctx context.Context, component string, bucket string, path string, r io.Reader) error

Upload transfers data from an io.Reader to a specified path within a Google Cloud Storage bucket, respecting the context provided for the operation. It requires a context for cancelation and deadline control, the name of the bucket, the destination path within that bucket, and the data source as an io.Reader. In case of success, it returns nil; otherwise, it returns an error indicating what went wrong during the upload process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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