Class StorageFileApi
- Inheritance
-
Storage
File Api
- Implements
- Inherited Members
Constructors
StorageFileApi(string, Dictionary<string, string>?, string?)
public StorageFileApi(string url, Dictionary<string, string>? headers = null, string? bucketId = null)
Parameters
url
stringheaders
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
stringbucketId
stringoptions
ClientOptions headers
Dictionary<string, string>
Properties
BucketId
Property Value
Headers
Property Value
Options
Property Value
Url
Property Value
Methods
CreateSignedUrl(string, int, TransformOptions?)
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)
Parameters
path
stringThe file path to be downloaded, including the current file name. For example
folder/image.png
.expiresIn
intThe number of seconds until the signed URL expires. For example,
60
for a URL which is valid for one minute.transformOptions
TransformOptions
Returns
CreateSignedUrls(List<string>, int)
Create signed URLs to download files without requiring permissions. These URLs can be valid for a set number of seconds.
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
intThe number of seconds until the signed URLs expire. For example,
60
for URLs which are valid for one minute.
Returns
CreateUploadSignedUrl(string)
Creates an upload signed URL. Use it to upload a file straight to the bucket without credentials
Parameters
supabasePath
stringThe file path, including the current file name. For example
folder/image.png
.
Returns
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
stringtransformOptions
TransformOptions onProgress
EventHandler <float>
Returns
Download(string, EventHandler<float>?)
Downloads a byte array from a private bucket to be used programmatically. For public buckets DownloadPublicFile(string, TransformOptions?, EventHandler<float>?)
Parameters
supabasePath
stringonProgress
EventHandler <float>
Returns
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
stringlocalPath
stringtransformOptions
TransformOptions onProgress
EventHandler <float>
Returns
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
stringlocalPath
stringonProgress
EventHandler <float>
Returns
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
stringtransformOptions
TransformOptions onProgress
EventHandler <float>
Returns
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
stringlocalPath
stringtransformOptions
TransformOptions onProgress
EventHandler <float>
Returns
GetPublicUrl(string, TransformOptions?)
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.
Parameters
path
stringtransformOptions
TransformOptions
Returns
List(string, SearchOptions?)
Lists all the files within a bucket.
Parameters
path
stringoptions
SearchOptions
Returns
Move(string, string)
Moves an existing file, optionally renaming it at the same time.
Parameters
fromPath
stringThe original file path, including the current file name. For example
folder/image.png
.toPath
stringThe new file path, including the new file name. For example
folder/image-copy.png
.
Returns
Remove(List<string>)
Deletes files within the same bucket
Parameters
paths
List<string>An array of files to be deletes, including the path and file name. For example [
folder/image.png
].
Returns
Remove(string)
Deletes file within the same bucket
Parameters
path
stringA path to delete, for example
folder/image.png
.
Returns
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
stringThe 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
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
stringFile source path.
supabasePath
stringThe 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
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
stringThe 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
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
stringFile Source Path
supabasePath
stringThe 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
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
UploadSigned Url options
FileOptions onProgress
EventHandler <float>inferContentType
bool
Returns
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
stringFile Source Path
signedUrl
UploadSigned Url options
FileOptions onProgress
EventHandler <float>inferContentType
bool