gcsclient

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectInfo

type ObjectInfo struct {
	Name    string `json:"name"`
	Size    uint64 `json:"size"`
	Updated string `json:"updated"`
}

ObjectInfo contains metadata about a GCS object.

type Service

type Service struct {
	API *storage.Service
	Cfg *config.Config
}

Service wraps the Google Cloud Storage service and config.

func NewService

func NewService(ctx context.Context) (*Service, error)

NewService creates an authenticated GCS service.

func NewServiceWithClient

func NewServiceWithClient(ctx context.Context, client *http.Client, basePath string) (*Service, error)

NewServiceWithClient creates a GCS service using a provided HTTP client. This is useful for testing with mock servers.

func (*Service) DownloadObject

func (s *Service) DownloadObject(ctx context.Context, bucket, object string) (io.ReadCloser, error)

DownloadObject downloads a single object from GCS and returns a ReadCloser.

func (*Service) ListObjects

func (s *Service) ListObjects(ctx context.Context, bucket, prefix string) ([]ObjectInfo, error)

ListObjects lists objects in a GCS bucket matching the given prefix.

Jump to

Keyboard shortcuts

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