JavaScript SDK: storage reference
Every method that manages buckets and objects, with its signature.
StorageService#
| Method | Description |
|---|---|
from(bucketId: string): StorageBucketClient | Returns a client scoped to a specific bucket (DX parity Supabase). |
listBuckets(): Promise<AuraResponse<StorageBucket[]>> | List the project buckets. |
getBucket(id: string): Promise<AuraResponse<StorageBucket>> | Reads a bucket by its identifier. |
createBucket(name: string, options?: { public?: boolean; fileSizeLimit?: number; allowedMimeTypes?: string[]; }): Promise<AuraResponse<StorageBucket>> | Create a bucket. public (default false) makes its objects readable without authentication; fileSizeLimit (in bytes) and allowedMimeTypes limit the accepted files. |
updateBucket(id: string, options?: { public?: boolean; fileSizeLimit?: number; allowedMimeTypes?: string[]; }): Promise<AuraResponse<StorageBucket>> | Updates an existing bucket (PARTIAL update: only the provided fields are sent). |
deleteBucket(id: string): Promise<AuraResponse<null>> | Deletes a bucket by its identifier. |
upload(bucketId: string, path: string, file: Blob | File | ArrayBuffer | Uint8Array, options?: { contentType?: string; upsert?: boolean; metadata?: Record<string, string>; authToken?: string; signal?: AbortSignal; onUploadProgress?: (progress: UploadProgressEvent) => void; }): Promise<AuraResponse<UploadResult>> | Upload a file to a bucket. |
uploadToSignedUrl(signedUrl: string, file: Blob | File | ArrayBuffer | Uint8Array, options?: { contentType?: string; signal?: AbortSignal; onUploadProgress?: (progress: UploadProgressEvent) => void; }): Promise<AuraResponse<UploadResult>> | Direct upload to a pre-signed URL (createSignedUploadUrl). |
download(bucketId: string, path: string, options?: { transform?: ImageTransform; download?: boolean | string; }): BlobDownloadBuilder | Lazy download of a file. |
list(bucketId: string, pathOrOptions?: string | { prefix?: string; limit?: number; offset?: number; cursor?: string; authToken?: string; }, maybeOptions?: { prefix?: string; limit?: number; offset?: number; cursor?: string; authToken?: string; }): Promise<AuraResponse<FileEntry[]>> | List files in a bucket. |
remove(bucketId: string, paths: string[], options?: { permanent?: boolean; authToken?: string; }): Promise<AuraResponse<null>> | Delete one or more files from a bucket. |
listTrash(bucketId: string, options?: { prefix?: string; authToken?: string; }): Promise<AuraResponse<Array<{ key: string; size: number | null; content_type: string | null; deleted_at: string; }>>> | Lists objects placed in the trash (soft-delete) of a bucket. |
restore(bucketId: string, path: string, options?: { authToken?: string; }): Promise<AuraResponse<{ restored: boolean; key: string; }>> | Restores an object placed in the trash (soft-delete). |
copy(bucketId: string, fromPath: string, toPath: string, options?: { destinationBucket?: string; authToken?: string; }): Promise<AuraResponse<{ key: string; }>> | Copy a file within a bucket. |
move(bucketId: string, fromPath: string, toPath: string, options?: { destinationBucket?: string; authToken?: string; }): Promise<AuraResponse<{ key: string; }>> | Move/rename a file within a bucket or to another bucket. |
getMetadata(bucketId: string, path: string, options?: { authToken?: string; }): Promise<AuraResponse<ObjectMeta>> | Get file metadata. |
createSignedUrl(bucketId: string, path: string, expiresInSeconds?: number, options?: { transform?: ImageTransform; download?: boolean | string; authToken?: string; }): Promise<AuraResponse<{ url: string; signedUrl: string; expires_in: number; }>> | Generate a signed (temporary) download URL. |
createSignedUrls(bucketId: string, paths: string[], expiresInSeconds?: number, options?: { transform?: ImageTransform; download?: boolean | string; authToken?: string; }): Promise<AuraResponse<Array<{ path: string; url: string; signedUrl: string; expires_in: number; } | { path: string; error: AuraError; }>>> | Generates several signed URLs in one pass (batch). |
createSignedUploadUrl(bucketId: string, path: string, expiresInSeconds?: number, options?: { upsert?: boolean; authToken?: string; }): Promise<AuraResponse<{ url: string; signedUrl: string; expires_in: number; }>> | Generate a signed upload URL (presigned PUT). |
getPublicUrl(bucketId: string, path: string, options?: { transform?: ImageTransform; download?: boolean | string; }): string | Constructs a URL to a file in a bucket. |
StorageBucketClient#
Access client scoped to a specific bucket (DX parity Supabase).
| Property | Description |
|---|---|
readonly bucketId: string | Identifier of the bucket to which this client is linked: all its methods act on this bucket. |
| Method | Description |
|---|---|
upload(path: string, file: Blob | File | ArrayBuffer | Uint8Array, options?: { contentType?: string; upsert?: boolean; metadata?: Record<string, string>; authToken?: string; signal?: AbortSignal; onUploadProgress?: (progress: UploadProgressEvent) => void; }): Promise<AuraResponse<UploadResult>> | Upload a file to this bucket. |
uploadToSignedUrl(signedUrl: string, file: Blob | File | ArrayBuffer | Uint8Array, options?: { contentType?: string; signal?: AbortSignal; onUploadProgress?: (progress: UploadProgressEvent) => void; }): Promise<AuraResponse<UploadResult>> | Direct upload to a signed URL. |
download(path: string, options?: { transform?: ImageTransform; download?: boolean | string; }): BlobDownloadBuilder | Download a file from this bucket. |
list(pathOrOptions?: string | { prefix?: string; limit?: number; offset?: number; cursor?: string; authToken?: string; }, options?: { prefix?: string; limit?: number; offset?: number; cursor?: string; authToken?: string; }): Promise<AuraResponse<FileEntry[]>> | List the files in this bucket. |
remove(paths: string[], options?: { permanent?: boolean; authToken?: string; }): Promise<AuraResponse<null>> | Deletes one or more files from this bucket. |
listTrash(options?: { prefix?: string; authToken?: string; }): Promise<AuraResponse<Array<{ key: string; size: number | null; content_type: string | null; deleted_at: string; }>>> | Lists the files in the trash of this bucket (soft-delete). |
restore(path: string, options?: { authToken?: string; }): Promise<AuraResponse<{ restored: boolean; key: string; }>> | Restores a file from the Recycle Bin. |
copy(fromPath: string, toPath: string, options?: { destinationBucket?: string; authToken?: string; }): Promise<AuraResponse<{ key: string; }>> | Copies a file within this bucket or to another bucket. |
move(fromPath: string, toPath: string, options?: { destinationBucket?: string; authToken?: string; }): Promise<AuraResponse<{ key: string; }>> | Moves or renames a file within this bucket or to another bucket. |
createSignedUrl(path: string, expiresInSeconds?: number, options?: { transform?: ImageTransform; download?: boolean | string; authToken?: string; }): Promise<AuraResponse<{ url: string; signedUrl: string; expires_in: number; }>> | Creates a temporary signed URL for a file in this bucket. |
getMetadata(path: string, options?: { authToken?: string; }): Promise<AuraResponse<ObjectMeta>> | Reads metadata from a file in this bucket. |
createSignedUrls(paths: string[], expiresInSeconds?: number, options?: { transform?: ImageTransform; download?: boolean | string; authToken?: string; }): Promise<AuraResponse<Array<{ path: string; url: string; signedUrl: string; expires_in: number; } | { path: string; error: AuraError; }>>> | Creates multiple signed URLs in one pass for this bucket. |
createSignedUploadUrl(path: string, expiresInSeconds?: number, options?: { upsert?: boolean; authToken?: string; }): Promise<AuraResponse<{ url: string; signedUrl: string; expires_in: number; }>> | Creates a presigned upload URL (direct PUT). |
getPublicUrl(path: string, options?: { transform?: ImageTransform; download?: boolean | string; }): { data: { publicUrl: string; }; } | Returns the public URL of a file in this bucket. |
BlobDownloadBuilder#
Lazy download (Blob by default).
| Method | Description |
|---|---|
asStream(): StreamDownloadBuilder | Switches to streaming reading: the result becomes a ReadableStream instead of a Blob loaded into memory. |
then<TR1 = AuraResponse<Blob>, TR2 = never>(onfulfilled?: ((v: AuraResponse<Blob>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2> | Triggers the download (lazy: the request only starts at await); the result is memorized. |
StreamDownloadBuilder#
Variante flux — res.body (ReadableStream).
| Method | Description |
|---|---|
then<TR1 = AuraResponse<ReadableStream<Uint8Array>>, TR2 = never>(onfulfilled?: ((v: AuraResponse<ReadableStream<Uint8Array>>) => TR1 | PromiseLike<TR1>) | null, onrejected?: ((e: unknown) => TR2 | PromiseLike<TR2>) | null): Promise<TR1 | TR2> | Triggers streaming (lazy) download; the result is memorized. |
Generated page
This page is generated from the type declarations and comments of the SDK, so it cannot drift from the published code. For worked examples, read the guides.
@aurabase/aurabase-js@0.7.5 · aura@0.3.4↗ Report a problem