cloud

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cloud lets privconvert convert files in Amazon S3 (and S3-compatible storage such as Backblaze B2 or Cloudflare R2), Google Cloud Storage and Azure Blob Storage:

store := cloud.New(cloud.Options{})
defer store.Close()
res, err := pc.ConvertStorage(ctx, store, "word-to-pdf",
	"s3://my-bucket/input.docx", "s3://my-bucket/output.pdf", nil)

Each cloud's standard sign-in is used unless you pass your own client: the AWS default chain (environment, shared config, IAM role), Google Application Default Credentials, and for Azure AZURE_STORAGE_CONNECTION_STRING or DefaultAzureCredential. Clients are created on first use, so only the clouds you touch need credentials.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// S3Client is used for s3:// locations. For Backblaze B2 or Cloudflare R2,
	// create it with that provider's endpoint (s3.Options.BaseEndpoint).
	S3Client *s3.Client
	// GCSClient is used for gs:// locations.
	GCSClient *storage.Client
	// AzureClient is used for Azure locations. Its account must match the
	// account in the location.
	AzureClient *azblob.Client

	// S3PutObject adjusts the upload of a converted file, e.g. to set
	// ServerSideEncryption.
	S3PutObject func(*s3.PutObjectInput)
	// GCSWriter adjusts the upload of a converted file, e.g. to set Metadata.
	GCSWriter func(*storage.Writer)
	// AzureUpload adjusts the upload of a converted file, e.g. to set AccessTier.
	AzureUpload func(*azblob.UploadBufferOptions)
}

Options sets the clients and upload settings. Every field is optional.

type Storage

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

Storage implements privconvert.Storage for all supported clouds. It is safe for concurrent use.

func New

func New(opts Options) *Storage

New returns a Storage. Clients that are not in opts are created on first use.

func (*Storage) Close

func (s *Storage) Close() error

Close releases the Google Cloud Storage client this Storage created, if any.

func (*Storage) Exists

func (s *Storage) Exists(ctx context.Context, loc privconvert.Location) (bool, error)

func (*Storage) Read

func (s *Storage) Read(ctx context.Context, loc privconvert.Location) ([]byte, error)

func (*Storage) Write

func (s *Storage) Write(ctx context.Context, loc privconvert.Location, data []byte, contentType string, overwrite bool) error

Jump to

Keyboard shortcuts

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