Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/storagee/src/lib/index.ts>StorageFileApi

JS Client library to interact with Supabase Storage
Latest
class StorageFileApi
import { StorageFileApi } from "https://deno.land/x/storagee@1.3.0/src/lib/index.ts";

Constructors

new
StorageFileApi(
url: string,
headers?: { [key: string]: string; },
bucketId?: string,
)

Properties

protected
optional
bucketId: string
protected
headers: { [key: string]: string; }
protected
url: string

Methods

private
uploadOrUpdate(
method: "POST" | "PUT",
path: string,
fileBody:
| ArrayBuffer
| ArrayBufferView
| Blob
| File
| ReadableStream<Uint8Array>
| string
,
fileOptions?: FileOptions,
): Promise<{ data: { Key: string; } | null; error: Error | null; }>

Uploads a file to an existing bucket. or replaces an existing file at the specified path with a new one.

_getFinalPath(path: string)
createSignedUrl(path: string, expiresIn: number): Promise<{ data: { signedURL: string; } | null; error: Error | null; signedURL: string | null; }>

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

download(path: string): Promise<{ data: Blob | null; error: Error | null; }>

Downloads a file.

getPublicUrl(path: string): { data: { publicURL: string; } | null; error: Error | null; publicURL: string | null; }

Retrieve URLs for assets in public buckets

list(
path?: string,
options?: SearchOptions,
parameters?: FetchParameters,
): Promise<{ data: FileObject[] | null; error: Error | null; }>

Lists all the files within a bucket.

move(fromPath: string, toPath: string): Promise<{ data: { message: string; } | null; error: Error | null; }>

Moves an existing file, optionally renaming it at the same time.

remove(paths: string[]): Promise<{ data: FileObject[] | null; error: Error | null; }>

Deletes files within the same bucket

update(
path: string,
fileBody:
| ArrayBuffer
| ArrayBufferView
| Blob
| File
| ReadableStream<Uint8Array>
| string
,
fileOptions?: FileOptions,
): Promise<{ data: { Key: string; } | null; error: Error | null; }>

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

upload(
path: string,
fileBody:
| ArrayBuffer
| ArrayBufferView
| Blob
| File
| ReadableStream<Uint8Array>
| string
,
fileOptions?: FileOptions,
): Promise<{ data: { Key: string; } | null; error: Error | null; }>

Uploads a file to an existing bucket.