Table of Contents

Class StorageFileApi

Namespace
Supabase.Storage
Assembly
Supabase.Storage.dll
public class StorageFileApi : IStorageFileApi<FileObject>
Inheritance
StorageFileApi
Implements
Inherited Members

Constructors

StorageFileApi(string, Dictionary<string, string>?, string?)

public StorageFileApi(string url, Dictionary<string, string>? headers = null, string? bucketId = null)

Parameters

url string
headers Dictionary<string, string>
bucketId string

StorageFileApi(string, string, ClientOptions?, Dictionary<string, string>?)

public StorageFileApi(string url, string bucketId, ClientOptions? options, Dictionary<string, string>? headers = null)

Parameters

url string
bucketId string
options ClientOptions
headers Dictionary<string, string>

Properties

BucketId

protected string? BucketId { get; set; }

Property Value

string

Headers

protected Dictionary<string, string> Headers { get; set; }

Property Value

Dictionary<string, string>

Options

public ClientOptions Options { get; protected set; }

Property Value

ClientOptions

Url

protected string Url { get; set; }

Property Value

string

Methods

Copy(string, string, DestinationOptions?)

Copies a file/object from one path to another within a bucket or across buckets.

public Task<bool> Copy(string fromPath, string toPath, DestinationOptions? options = null)

Parameters

fromPath string

The source path of the file/object to copy.

toPath string

The destination path for the copied file/object.

options DestinationOptions

Optional parameters such as the destination bucket.

Returns

Task<bool>

True if the copy operation was successful.

CreateSignedUrl(string, int, TransformOptions?, DownloadOptions?)

Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.

public Task<string> CreateSignedUrl(string path, int expiresIn, TransformOptions? transformOptions = null, DownloadOptions? downloadOptions = null)

Parameters

path string

The file path to be downloaded, including the current file name. For example folder/image.png.

expiresIn int

The number of seconds until the signed URL expires. For example, 60 for a URL which is valid for one minute.

transformOptions TransformOptions
downloadOptions DownloadOptions

Returns

Task<string>

CreateSignedUrls(List<string>, int, DownloadOptions?)

Create signed URLs to download files without requiring permissions. These URLs can be valid for a set number of seconds.

public Task<List<CreateSignedUrlsResponse>?> CreateSignedUrls(List<string> paths, int expiresIn, DownloadOptions? downloadOptions = null)

Parameters

paths List<string>

paths The file paths to be downloaded, including the current file names. For example [folder/image.png, 'folder2/image2.png'].

expiresIn int

The number of seconds until the signed URLs expire. For example, 60 for URLs which are valid for one minute.

downloadOptions DownloadOptions

Returns

Task<List<CreateSignedUrlsResponse>>

CreateUploadSignedUrl(string)

Creates an upload signed URL. Use it to upload a file straight to the bucket without credentials

public Task<UploadSignedUrl> CreateUploadSignedUrl(string supabasePath)

Parameters

supabasePath string

The file path, including the current file name. For example folder/image.png.

Returns

Task<UploadSignedUrl>

Download(string, TransformOptions?, EventHandler<float>?)

Downloads a byte array from a private bucket to be used programmatically. For public buckets DownloadPublicFile(string, TransformOptions?, EventHandler<float>?)

public Task<byte[]> Download(string supabasePath, TransformOptions? transformOptions = null, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
transformOptions TransformOptions
onProgress EventHandler<float>

Returns

Task<byte[]>

Download(string, EventHandler<float>?)

Downloads a byte array from a private bucket to be used programmatically. For public buckets DownloadPublicFile(string, TransformOptions?, EventHandler<float>?)

public Task<byte[]> Download(string supabasePath, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
onProgress EventHandler<float>

Returns

Task<byte[]>

Download(string, string, TransformOptions?, EventHandler<float>?)

Downloads a file from a private bucket. For public buckets, use DownloadPublicFile(string, string, TransformOptions?, EventHandler<float>?)

public Task<string> Download(string supabasePath, string localPath, TransformOptions? transformOptions = null, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
localPath string
transformOptions TransformOptions
onProgress EventHandler<float>

Returns

Task<string>

Download(string, string, EventHandler<float>?)

Downloads a file from a private bucket. For public buckets, use DownloadPublicFile(string, string, TransformOptions?, EventHandler<float>?)

public Task<string> Download(string supabasePath, string localPath, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
localPath string
onProgress EventHandler<float>

Returns

Task<string>

DownloadPublicFile(string, TransformOptions?, EventHandler<float>?)

Downloads a byte array from a private bucket to be used programmatically. This method DOES NOT VERIFY that the file is actually public.

public Task<byte[]> DownloadPublicFile(string supabasePath, TransformOptions? transformOptions = null, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
transformOptions TransformOptions
onProgress EventHandler<float>

Returns

Task<byte[]>

DownloadPublicFile(string, string, TransformOptions?, EventHandler<float>?)

Downloads a public file to the filesystem. This method DOES NOT VERIFY that the file is actually public.

public Task<string> DownloadPublicFile(string supabasePath, string localPath, TransformOptions? transformOptions = null, EventHandler<float>? onProgress = null)

Parameters

supabasePath string
localPath string
transformOptions TransformOptions
onProgress EventHandler<float>

Returns

Task<string>

GetPublicUrl(string, TransformOptions?, DownloadOptions?)

A simple convenience function to get the URL for an asset in a public bucket.If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset. This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.

public string GetPublicUrl(string path, TransformOptions? transformOptions, DownloadOptions? downloadOptions = null)

Parameters

path string
transformOptions TransformOptions
downloadOptions DownloadOptions

Returns

string

Info(string)

Retrieves the details of an existing file.

public Task<FileObjectV2?> Info(string path)

Parameters

path string

Returns

Task<FileObjectV2>

List(string, SearchOptions?)

Lists all the files within a bucket.

public Task<List<FileObject>?> List(string path = "", SearchOptions? options = null)

Parameters

path string
options SearchOptions

Returns

Task<List<FileObject>>

Move(string, string, DestinationOptions?)

Moves an existing file to a new location, optionally allowing renaming.

public Task<bool> Move(string fromPath, string toPath, DestinationOptions? options = null)

Parameters

fromPath string

The original file path, including the current file name (e.g., folder/image.png).

toPath string

The target file path, including the new file name (e.g., folder/image-copy.png).

options DestinationOptions

Optional parameters for specifying the destination bucket and other settings.

Returns

Task<bool>

Returns a boolean value indicating whether the operation was successful.

Remove(List<string>)

Deletes files within the same bucket

public Task<List<FileObject>?> Remove(List<string> paths)

Parameters

paths List<string>

An array of files to be deletes, including the path and file name. For example [folder/image.png].

Returns

Task<List<FileObject>>

Remove(string)

Deletes file within the same bucket

public Task<FileObject?> Remove(string path)

Parameters

path string

A path to delete, for example folder/image.png.

Returns

Task<FileObject>

Update(byte[], string, FileOptions?, EventHandler<float>?)

Replaces an existing file at the specified path with a new one.

public Task<string> Update(byte[] data, string supabasePath, FileOptions? options = null, EventHandler<float>? onProgress = null)

Parameters

data byte[]
supabasePath string

The relative file path. Should be of the format folder/subfolder/filename.png. The bucket must already exist before attempting to upload.

options FileOptions

HTTP headers.

onProgress EventHandler<float>

Returns

Task<string>

Update(string, string, FileOptions?, EventHandler<float>?)

Replaces an existing file at the specified path with a new one.

public Task<string> Update(string localFilePath, string supabasePath, FileOptions? options = null, EventHandler<float>? onProgress = null)

Parameters

localFilePath string

File source path.

supabasePath string

The relative file path. Should be of the format folder/subfolder/filename.png. The bucket must already exist before attempting to upload.

options FileOptions

HTTP headers.

onProgress EventHandler<float>

Returns

Task<string>

Upload(byte[], string, FileOptions?, EventHandler<float>?, bool)

Uploads a byte array to an existing bucket.

public Task<string> Upload(byte[] data, string supabasePath, FileOptions? options = null, EventHandler<float>? onProgress = null, bool inferContentType = true)

Parameters

data byte[]
supabasePath string

The relative file path. Should be of the format folder/subfolder/filename.png. The bucket must already exist before attempting to upload.

options FileOptions
onProgress EventHandler<float>
inferContentType bool

Returns

Task<string>

Upload(string, string, FileOptions?, EventHandler<float>?, bool)

Uploads a file to an existing bucket.

public Task<string> Upload(string localFilePath, string supabasePath, FileOptions? options = null, EventHandler<float>? onProgress = null, bool inferContentType = true)

Parameters

localFilePath string

File Source Path

supabasePath string

The relative file path. Should be of the format folder/subfolder/filename.png. The bucket must already exist before attempting to upload.

options FileOptions
onProgress EventHandler<float>
inferContentType bool

Returns

Task<string>

UploadToSignedUrl(byte[], UploadSignedUrl, FileOptions?, EventHandler<float>?, bool)

Uploads a byte array using a pre-generated Signed Upload Url

public Task<string> UploadToSignedUrl(byte[] data, UploadSignedUrl signedUrl, FileOptions? options = null, EventHandler<float>? onProgress = null, bool inferContentType = true)

Parameters

data byte[]
signedUrl UploadSignedUrl
options FileOptions
onProgress EventHandler<float>
inferContentType bool

Returns

Task<string>

UploadToSignedUrl(string, UploadSignedUrl, FileOptions?, EventHandler<float>?, bool)

Uploads a file to using a pre-generated Signed Upload Url

public Task<string> UploadToSignedUrl(string localFilePath, UploadSignedUrl signedUrl, FileOptions? options = null, EventHandler<float>? onProgress = null, bool inferContentType = true)

Parameters

localFilePath string

File Source Path

signedUrl UploadSignedUrl
options FileOptions
onProgress EventHandler<float>
inferContentType bool

Returns

Task<string>