js-bao-wss-client / BlobBucketsAPI
Interface: BlobBucketsAPI
Sub-API for blob storage (client.blobBuckets.*). Buckets are named containers with a retention tier and an access preset or custom rule set; blobs are uploaded into buckets and downloaded, listed, deleted, or shared via signed URLs. Bucket management calls require admin/owner permission.
Methods
createBucket()
createBucket(
params):Promise<BlobBucketInfo>
Create a new blob bucket (admin/owner only).
Parameters
params
Returns
Promise<BlobBucketInfo>
delete()
Call Signature
delete(
bucketIdOrKey,blobId):Promise<{deleted:boolean; }>
Delete one blob (DELETE .../blobs/:blobId) → { deleted: boolean }. Back-compat, unchanged.
Parameters
bucketIdOrKey
string
blobId
string
Returns
Promise<{ deleted: boolean; }>
Call Signature
delete(
bucketIdOrKey,blobIds):Promise<BatchBlobDeleteResult>
Batch delete blobs. Routes to POST .../blobs/delete with { blobIds }. All-or-nothing: if the bucket delete rule denies any id the whole batch fails (403, nothing deleted). deleted counts ids processed (input length, duplicates included). Max 500 ids; an empty array is a no-op.
A missing id is screened against the delete rule with blobCreatedBy == null, exactly like the single delete(bucket, id) path — so a missing id and an existing-but-unauthorized id are indistinguishable (no existence oracle). Under an open member-delete rule a missing id is a no-op, but under a strict uploader-scoped rule (record.blobCreatedBy == user.userId) a retry over already-deleted ids is DENIED. To opt into idempotent cleanup, write a delete rule that permits gone blobs, e.g. record.blobCreatedBy == null || record.blobCreatedBy == user.userId.
Parameters
bucketIdOrKey
string
blobIds
string[]
Returns
Promise<BatchBlobDeleteResult>
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 cursor pagination.
Parameters
bucketIdOrKey
string
options?
Returns
Promise<BucketBlobListResult>
listBuckets()
listBuckets():
Promise<BlobBucketInfo[]>
List all blob buckets for the current app (admin/owner only).
Returns
Promise<BlobBucketInfo[]>
updateBucket()
updateBucket(
bucketIdOrKey,params):Promise<BlobBucketInfo>
Update a bucket's access without recreating it. Admin/owner only. Change the preset, attach/swap/clear a custom ruleSetId, or edit name/description. Setting a non-custom preset clears any rule set.
Parameters
bucketIdOrKey
string
params
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
Returns
Promise<BucketBlobUploadResult>