Skip to content

StorageBucket

new StorageBucket(fetch, bucketName): StorageBucket

ParameterType
fetchFluxbaseFetch
bucketNamestring

StorageBucket

copy(fromPath, toPath): Promise<object>

Copy a file to a new location

ParameterTypeDescription
fromPathstringSource file path
toPathstringDestination file path

Promise<object>

NameType
datanull | object
errornull | Error

createSignedUrl(path, options?): Promise<object>

Create a signed URL for temporary access to a file

ParameterTypeDescription
pathstringThe file path
options?SignedUrlOptionsSigned URL options

Promise<object>

NameType
datanull | object
errornull | Error

download(path): Promise<object>

Download a file from the bucket

ParameterTypeDescription
pathstringThe path/key of the file

Promise<object>

NameType
datanull | Blob
errornull | Error
// Default: returns Blob
const { data: blob } = await storage.from('bucket').download('file.pdf');
// Streaming: returns { stream, size } for progress tracking
const { data } = await storage.from('bucket').download('large.json', { stream: true });
console.log(`File size: ${data.size} bytes`);
// Process data.stream...

download(path, options): Promise<object>

ParameterType
pathstring
optionsobject
options.signal?AbortSignal
options.streamtrue
options.timeout?number

Promise<object>

NameType
datanull | StreamDownloadData
errornull | Error

download(path, options): Promise<object>

ParameterType
pathstring
optionsobject
options.signal?AbortSignal
options.stream?false
options.timeout?number

Promise<object>

NameType
datanull | Blob
errornull | Error

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
ParameterTypeDescription
pathstringThe file path within the bucket
options?ResumableDownloadOptionsDownload options including chunk size, retries, and progress callback

Promise<object>

A ReadableStream and file size (consumer doesn’t need to know about chunking)

NameType
datanull | ResumableDownloadData
errornull | Error
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(path): object

Get a public URL for a file

ParameterTypeDescription
pathstringThe file path

object

NameType
dataobject
data.publicUrlstring

list(pathOrOptions?, maybeOptions?): Promise<object>

List files in the bucket Supports both Supabase-style list(path, options) and Fluxbase-style list(options)

ParameterTypeDescription
pathOrOptions?string | ListOptionsThe folder path or list options
maybeOptions?ListOptionsList options when first param is a path

Promise<object>

NameType
datanull | FileObject[]
errornull | Error

listShares(path): Promise<object>

List users a file is shared with (RLS)

ParameterTypeDescription
pathstringThe file path

Promise<object>

NameType
datanull | FileShare[]
errornull | Error

move(fromPath, toPath): Promise<object>

Move a file to a new location

ParameterTypeDescription
fromPathstringCurrent file path
toPathstringNew file path

Promise<object>

NameType
datanull | object
errornull | Error

remove(paths): Promise<object>

Remove files from the bucket

ParameterTypeDescription
pathsstring[]Array of file paths to remove

Promise<object>

NameType
datanull | FileObject[]
errornull | Error

revokeShare(path, userId): Promise<object>

Revoke file access from a user (RLS)

ParameterTypeDescription
pathstringThe file path
userIdstringThe user ID to revoke access from

Promise<object>

NameType
datanull
errornull | Error

share(path, options): Promise<object>

Share a file with another user (RLS)

ParameterTypeDescription
pathstringThe file path
optionsShareFileOptionsShare options (userId and permission)

Promise<object>

NameType
datanull
errornull | Error

upload(path, file, options?): Promise<object>

Upload a file to the bucket

ParameterTypeDescription
pathstringThe path/key for the file
fileBlob | ArrayBufferView | ArrayBuffer | FileThe file to upload (File, Blob, ArrayBuffer, or ArrayBufferView like Uint8Array)
options?UploadOptionsUpload options

Promise<object>

NameType
datanull | object
errornull | Error