supabase-community/storage-go

Storage util client for Supabase in Go

Go

62

55 commits

updated Sep 8, 2026

See the code

README

Storage GO

[!IMPORTANT] Update, September 2026:
This codebase is not being actively maintained by Supabase or the community, but it's not the end of the road... We're busy building an official Supabase SDK for Go that will make this repository and the module it publishes obsolete. This thread has more information, as well as providing a venue for discussion in the meantime.

This library is a Golang client for the Supabase Storage API. It's a collection of helper functions that help you manage your buckets through the API.

Quick start guide

Install

go get github.com/supabase-community/storage-go

Connecting to the storage backend

package main

import (
	"fmt"
	"log"
	"os"

	storage_go "github.com/supabase-community/storage-go"
)

func main() {
	storageClient := storage_go.NewClient("https://<project-reference-id>.supabase.co/storage/v1", "<project-secret-api-key>", nil)
}

Handling resources

Handling Storage Buckets

  • Create a new Storage bucket:
  result, err := storageClient.CreateBucket("bucket-id", storage_go.BucketOptions{
    Public: true,
  })
  • Retrieve the details of an existing Storage bucket:
  result, err := storageClient.GetBucket("bucket-id")
  • Update a new Storage bucket:
  result, err := storageClient.UpdateBucket("bucket-id", storage_go.BucketOptions{
    Public: true,
  })
  • Remove all objects inside a single bucket:
  result, err := storageClient.EmptyBucket("bucket-id")
  • Delete an existing bucket (a bucket can't be deleted with existing objects inside it):
  result, err := storageClient.DeleteBucket("bucket-id")
  • Retrieve the details of all Storage buckets within an existing project:
  result, err := storageClient.ListBuckets("bucket-id")

Handling Files

  fileBody := ... // load your file here

  result, err := storageClient.UploadFile("test", "test.txt", fileBody)

Note: The upload method also accepts a map of optional parameters.

  • Download a file from an exisiting bucket:
  result, err := storageClient.DownloadFile("bucket-id", "test.txt")
  • List all the files within a bucket:
  result, err := storageClient.ListFiles("bucket-id", "", storage_go.FileSearchOptions{
      Limit:  10,
      Offset: 0,
      SortByOptions: storage_go.SortBy{
      Column: "",
      Order:  "",
    },
  })

Note: The list method also accepts a map of optional parameters.

  • Replace an existing file at the specified path with a new one:
  fileBody := ... // load your file here

  result, err := storageClient.UpdateFile("test", "test.txt", file)
  • Move an existing file:
  result, err := storageClient.MoveFile("test", "test.txt", "random/test.txt")
  • Delete files within the same bucket:
  result, err := storageClient.RemoveFile("test", []string{"book.pdf"})
  • Create signed URL to download file without requiring permissions:
  const expireIn = 60

  result, err := storageClient.CreateSignedUrl("test", "test.mp4", expireIn)
  • Retrieve URLs for assets in public buckets:
  result, err := storageClient.GetPublicUrl("test", "book.pdf")
  • Create an signed URL and upload to signed URL:
  fileBody := ... // load your file here

  resp, err := storageClient.CreateSignedUploadUrl("test", "test.txt")
  res, err := storageClient.UploadToSignedUrl(resp.Url, file)

License

hacktoberfest
storage
supabase

supabase-community/storage-go

Storage util client for Supabase in Go

Go

62

55 commits

updated Sep 8, 2026

See the code

README

Storage GO

[!IMPORTANT] Update, September 2026:
This codebase is not being actively maintained by Supabase or the community, but it's not the end of the road... We're busy building an official Supabase SDK for Go that will make this repository and the module it publishes obsolete. This thread has more information, as well as providing a venue for discussion in the meantime.

This library is a Golang client for the Supabase Storage API. It's a collection of helper functions that help you manage your buckets through the API.

Quick start guide

Install

go get github.com/supabase-community/storage-go

Connecting to the storage backend

package main

import (
	"fmt"
	"log"
	"os"

	storage_go "github.com/supabase-community/storage-go"
)

func main() {
	storageClient := storage_go.NewClient("https://<project-reference-id>.supabase.co/storage/v1", "<project-secret-api-key>", nil)
}

Handling resources

Handling Storage Buckets

  • Create a new Storage bucket:
  result, err := storageClient.CreateBucket("bucket-id", storage_go.BucketOptions{
    Public: true,
  })
  • Retrieve the details of an existing Storage bucket:
  result, err := storageClient.GetBucket("bucket-id")
  • Update a new Storage bucket:
  result, err := storageClient.UpdateBucket("bucket-id", storage_go.BucketOptions{
    Public: true,
  })
  • Remove all objects inside a single bucket:
  result, err := storageClient.EmptyBucket("bucket-id")
  • Delete an existing bucket (a bucket can't be deleted with existing objects inside it):
  result, err := storageClient.DeleteBucket("bucket-id")
  • Retrieve the details of all Storage buckets within an existing project:
  result, err := storageClient.ListBuckets("bucket-id")

Handling Files

  fileBody := ... // load your file here

  result, err := storageClient.UploadFile("test", "test.txt", fileBody)

Note: The upload method also accepts a map of optional parameters.

  • Download a file from an exisiting bucket:
  result, err := storageClient.DownloadFile("bucket-id", "test.txt")
  • List all the files within a bucket:
  result, err := storageClient.ListFiles("bucket-id", "", storage_go.FileSearchOptions{
      Limit:  10,
      Offset: 0,
      SortByOptions: storage_go.SortBy{
      Column: "",
      Order:  "",
    },
  })

Note: The list method also accepts a map of optional parameters.

  • Replace an existing file at the specified path with a new one:
  fileBody := ... // load your file here

  result, err := storageClient.UpdateFile("test", "test.txt", file)
  • Move an existing file:
  result, err := storageClient.MoveFile("test", "test.txt", "random/test.txt")
  • Delete files within the same bucket:
  result, err := storageClient.RemoveFile("test", []string{"book.pdf"})
  • Create signed URL to download file without requiring permissions:
  const expireIn = 60

  result, err := storageClient.CreateSignedUrl("test", "test.mp4", expireIn)
  • Retrieve URLs for assets in public buckets:
  result, err := storageClient.GetPublicUrl("test", "book.pdf")
  • Create an signed URL and upload to signed URL:
  fileBody := ... // load your file here

  resp, err := storageClient.CreateSignedUploadUrl("test", "test.txt")
  res, err := storageClient.UploadToSignedUrl(resp.Url, file)

License

hacktoberfest
storage
supabase

Project health

Overall

2.2/10

Maintained

2/10

Code review

3/10
OpenSSF Scorecard

Latest release

v0.8.1 · Sep 10, 2025

Releases this year

0