Skip to content

js-bao-wss-client


js-bao-wss-client / BlobBucketsAPI

Interface: BlobBucketsAPI

Methods

createBucket()

createBucket(params): Promise<BlobBucketInfo>

Create a new blob bucket (admin/owner only).

Parameters

params

CreateBlobBucketParams

Returns

Promise<BlobBucketInfo>


delete()

delete(bucketIdOrKey, blobId): Promise<{ deleted: boolean; }>

Delete a blob from a bucket.

Parameters

bucketIdOrKey

string

blobId

string

Returns

Promise<{ deleted: boolean; }>


deleteBucket()

deleteBucket(bucketIdOrKey): Promise<{ deleted: boolean; }>

Delete a bucket and all blobs inside it.

Parameters

bucketIdOrKey

string

Returns

Promise<{ deleted: boolean; }>


download()

download(bucketIdOrKey, blobId): Promise<ArrayBuffer>

Download a blob as an ArrayBuffer.

Parameters

bucketIdOrKey

string

blobId

string

Returns

Promise<ArrayBuffer>


getBucket()

getBucket(bucketIdOrKey): Promise<BlobBucketInfo>

Get a single bucket by its bucketId or bucketKey.

Parameters

bucketIdOrKey

string

Returns

Promise<BlobBucketInfo>


getMetadata()

getMetadata(bucketIdOrKey, blobId): Promise<BlobInfo>

Get blob metadata without downloading content.

Parameters

bucketIdOrKey

string

blobId

string

Returns

Promise<BlobInfo>


getSignedUrl()

getSignedUrl(bucketIdOrKey, blobId, expiresInSeconds?): Promise<BlobSignedUrlResult>

Get a time-limited signed URL that can be used to download a blob without auth.

Parameters

bucketIdOrKey

string

blobId

string

expiresInSeconds?

number

Returns

Promise<BlobSignedUrlResult>


list()

list(bucketIdOrKey, options?): Promise<BucketBlobListResult>

List blobs in a bucket. Uses R2 cursor pagination.

Parameters

bucketIdOrKey

string

options?

BlobListOptions

Returns

Promise<BucketBlobListResult>


listBuckets()

listBuckets(): Promise<BlobBucketInfo[]>

List all blob buckets for the current app (admin/owner only).

Returns

Promise<BlobBucketInfo[]>


upload()

upload(bucketIdOrKey, params): Promise<BucketBlobUploadResult>

Upload a blob into a bucket. Returns metadata including the generated blobId.

Parameters

bucketIdOrKey

string

params

BlobUploadParams

Returns

Promise<BucketBlobUploadResult>