StorageBucket
Constructors
Section titled “Constructors”new StorageBucket()
Section titled “new StorageBucket()”new StorageBucket(
fetch,bucketName):StorageBucket
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
bucketName | string |
Returns
Section titled “Returns”Methods
Section titled “Methods”copy()
Section titled “copy()”copy(
fromPath,toPath):Promise<object>
Copy a file to a new location
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fromPath | string | Source file path |
toPath | string | Destination file path |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | object |
error | null | Error |
createSignedUrl()
Section titled “createSignedUrl()”createSignedUrl(
path,options?):Promise<object>
Create a signed URL for temporary access to a file
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path |
options? | SignedUrlOptions | Signed URL options |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | object |
error | null | Error |
download()
Section titled “download()”download(path)
Section titled “download(path)”download(
path):Promise<object>
Download a file from the bucket
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The path/key of the file |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | Blob |
error | null | Error |
Example
Section titled “Example”// Default: returns Blobconst { data: blob } = await storage.from('bucket').download('file.pdf');
// Streaming: returns { stream, size } for progress trackingconst { data } = await storage.from('bucket').download('large.json', { stream: true });console.log(`File size: ${data.size} bytes`);// Process data.stream...download(path, options)
Section titled “download(path, options)”download(
path,options):Promise<object>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
path | string |
options | object |
options.signal? | AbortSignal |
options.stream | true |
options.timeout? | number |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | StreamDownloadData |
error | null | Error |
download(path, options)
Section titled “download(path, options)”download(
path,options):Promise<object>
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
path | string |
options | object |
options.signal? | AbortSignal |
options.stream? | false |
options.timeout? | number |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | Blob |
error | null | Error |
downloadResumable()
Section titled “downloadResumable()”downloadResumable(
path,options?):Promise<object>
Download a file with resumable chunked downloads for large files. Returns a ReadableStream that abstracts the chunking internally.
Features:
- Downloads file in chunks using HTTP Range headers
- Automatically retries failed chunks with exponential backoff
- Reports progress via callback
- Falls back to regular streaming if Range not supported
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path within the bucket |
options? | ResumableDownloadOptions | Download options including chunk size, retries, and progress callback |
Returns
Section titled “Returns”Promise<object>
A ReadableStream and file size (consumer doesn’t need to know about chunking)
| Name | Type |
|---|---|
data | null | ResumableDownloadData |
error | null | Error |
Example
Section titled “Example”const { data, error } = await storage.from('bucket').downloadResumable('large.json', { chunkSize: 5 * 1024 * 1024, // 5MB chunks maxRetries: 3, onProgress: (progress) => console.log(`${progress.percentage}% complete`)});if (data) { console.log(`File size: ${data.size} bytes`); // Process data.stream...}getPublicUrl()
Section titled “getPublicUrl()”getPublicUrl(
path):object
Get a public URL for a file
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path |
Returns
Section titled “Returns”object
| Name | Type |
|---|---|
data | object |
data.publicUrl | string |
list()
Section titled “list()”list(
pathOrOptions?,maybeOptions?):Promise<object>
List files in the bucket Supports both Supabase-style list(path, options) and Fluxbase-style list(options)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pathOrOptions? | string | ListOptions | The folder path or list options |
maybeOptions? | ListOptions | List options when first param is a path |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | FileObject[] |
error | null | Error |
listShares()
Section titled “listShares()”listShares(
path):Promise<object>
List users a file is shared with (RLS)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | FileShare[] |
error | null | Error |
move()
Section titled “move()”move(
fromPath,toPath):Promise<object>
Move a file to a new location
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fromPath | string | Current file path |
toPath | string | New file path |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | object |
error | null | Error |
remove()
Section titled “remove()”remove(
paths):Promise<object>
Remove files from the bucket
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
paths | string[] | Array of file paths to remove |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | FileObject[] |
error | null | Error |
revokeShare()
Section titled “revokeShare()”revokeShare(
path,userId):Promise<object>
Revoke file access from a user (RLS)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path |
userId | string | The user ID to revoke access from |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null |
error | null | Error |
share()
Section titled “share()”share(
path,options):Promise<object>
Share a file with another user (RLS)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The file path |
options | ShareFileOptions | Share options (userId and permission) |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null |
error | null | Error |
upload()
Section titled “upload()”upload(
path,file,options?):Promise<object>
Upload a file to the bucket
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
path | string | The path/key for the file |
file | Blob | ArrayBufferView | ArrayBuffer | File | The file to upload (File, Blob, ArrayBuffer, or ArrayBufferView like Uint8Array) |
options? | UploadOptions | Upload options |
Returns
Section titled “Returns”Promise<object>
| Name | Type |
|---|---|
data | null | object |
error | null | Error |