storage

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package storage provides a client for Supabase Storage API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods to interact with Supabase Storage

func New

func New(supabaseURL, publishableKey, secretKey string) *Client

New creates a new Storage client. publishableKey is used for the apikey header (project identification). secretKey is used for the Authorization header (service_role access). If publishableKey is empty, secretKey is used for both headers (legacy behaviour).

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, bucket, path string) error

Delete removes a file from storage

func (*Client) GetPublicURL

func (c *Client) GetPublicURL(bucket, path string) string

GetPublicURL returns the public URL for a file (if bucket is public)

func (*Client) GetSignedURL

func (c *Client) GetSignedURL(ctx context.Context, bucket, path string, expiresIn int) (string, error)

GetSignedURL returns a signed URL for temporary access to a private file

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, bucket, path string, data []byte, contentType string) (string, error)

Upload uploads a file to the specified bucket and path Returns the full path of the uploaded file

func (*Client) UploadWithOptions

func (c *Client) UploadWithOptions(ctx context.Context, bucket, path string, data []byte, options UploadOptions) (string, error)

UploadWithOptions uploads a file to the specified bucket and path with optional headers. Returns the full path of the uploaded file.

type UploadOptions

type UploadOptions struct {
	ContentType     string
	ContentEncoding string
}

UploadOptions configures a storage upload request.

Jump to

Keyboard shortcuts

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