Supabase.Storage
2.5.0
dotnet add package Supabase.Storage --version 2.5.0
NuGet\Install-Package Supabase.Storage -Version 2.5.0
<PackageReference Include="Supabase.Storage" Version="2.5.0" />
<PackageVersion Include="Supabase.Storage" Version="2.5.0" />
<PackageReference Include="Supabase.Storage" />
paket add Supabase.Storage --version 2.5.0
#r "nuget: Supabase.Storage, 2.5.0"
#:package Supabase.Storage@2.5.0
#addin nuget:?package=Supabase.Storage&version=2.5.0
#tool nuget:?package=Supabase.Storage&version=2.5.0
Supabase.Storage
Integrate your Supabase projects with C#.
[Notice]: v2.0.0 renames this package from storage-csharp to Supabase.Storage. The depreciation notice has been set in NuGet. The API remains the same.
Examples (using supabase-csharp)
public async void Main()
{
// Make sure you set these (or similar)
var url = Environment.GetEnvironmentVariable("SUPABASE_URL");
var key = Environment.GetEnvironmentVariable("SUPABASE_KEY");
await Supabase.Client.InitializeAsync(url, key);
// The Supabase Instance can be accessed at any time using:
// Supabase.Client.Instance {.Realtime|.Auth|etc.}
// For ease of readability we'll use this:
var instance = Supabase.Client.Instance;
// Interact with Supabase Storage
var storage = Supabase.Client.Instance.Storage
await storage.CreateBucket("testing")
var bucket = storage.From("testing");
var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:", "");
var imagePath = Path.Combine(basePath, "Assets", "supabase-csharp.png");
await bucket.Upload(imagePath, "supabase-csharp.png");
// If bucket is public, get url
bucket.GetPublicUrl("supabase-csharp.png");
// If bucket is private, generate url
await bucket.CreateSignedUrl("supabase-csharp.png", 3600));
// Download it!
await bucket.Download("supabase-csharp.png", Path.Combine(basePath, "testing-download.png"));
}
Observability (OpenTelemetry)
The client emits traces and metrics through System.Diagnostics, so you can wire them into
OpenTelemetry (or any ActivityListener/MeterListener) without the client taking a dependency
on the OpenTelemetry packages. Emission is zero-cost while nothing is listening, so it is always
on and stays silent until you subscribe.
Register the client's ActivitySource and Meter by name. Use the StorageDiagnostics.SourceName
constant rather than hardcoding the string, so a typo becomes a compile error instead of a silent
no-op:
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
using Supabase.Storage;
// Requires the OpenTelemetry.Extensions.Hosting and an exporter package (e.g. OTLP) in your app.
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddSource(StorageDiagnostics.SourceName)
.AddOtlpExporter())
.WithMetrics(metrics => metrics
.AddMeter(StorageDiagnostics.SourceName)
.AddOtlpExporter());
Once subscribed you get:
- A client span per request, named
{METHOD} {path}and following OpenTelemetry HTTP conventions (method, status code, and a sanitized URL). The query string is never recorded — Storage signed URLs carry atokenthere. Upload and download spans additionally carry astorage.transfer.directiontag (upload/download). The resumable (TUS) upload is reported as a single operation span covering the whole transfer, rather than one span per underlying chunk request. supabase.storage.http.request.duration(seconds) for control-plane requests.supabase.storage.transfer.duration(seconds) andsupabase.storage.transfer.size(bytes) for uploads and downloads, tagged by direction — because a duration alone does not describe a file transfer.
If you are not using the OpenTelemetry SDK, a raw listener works too:
using System.Diagnostics;
using Supabase.Storage;
using var listener = new ActivityListener
{
ShouldListenTo = source => source.Name == StorageDiagnostics.SourceName,
Sample = (ref ActivityCreationOptions<ActivityContext> _) => ActivitySamplingResult.AllData,
ActivityStopped = activity => Console.WriteLine($"{activity.OperationName} {activity.Duration.TotalMilliseconds}ms {activity.Status}")
};
ActivitySource.AddActivityListener(listener);
Package made possible through the efforts of:
Join the ranks! See a problem? Help fix it!
<a href="https://github.com/supabase-community/storage-csharp/graphs/contributors"> <img src="https://contrib.rocks/image?repo=supabase-community/storage-csharp" /> </a>
Made with contrib.rocks.
Contributing
We are more than happy to have contributions! Please submit a PR.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- BirdMessenger (>= 4.0.0)
- MimeMapping (>= 4.0.0)
- Newtonsoft.Json (>= 13.0.2)
- Supabase.Core (>= 1.2.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Supabase.Storage:
| Package | Downloads |
|---|---|
|
Supabase
A C# implementation of the Supabase client |
|
|
benxu.AppPlatform.Supabase.Storage
Supabase Storage implementation for benxu App Platform. Provides object upload, download, listing, file copy, move, delete, and signed/public URL generation for .NET MAUI applications. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Supabase.Storage:
| Repository | Stars |
|---|---|
|
supabase-community/supabase-csharp
A C# Client library for Supabase
|