Skip to content

Bucket

Defined in: core/src/bucket/bucket.instance.ts:27

A place to keep file blobs, addressed by /-separated keys. Backed by whatever BucketStorage the container’s bucketCreator produces; the backend is opened on first use and reused thereafter.

new Bucket(options): Bucket;

Defined in: core/src/bucket/bucket.instance.ts:31

Parameter Type
options BucketInstanceOptions

Bucket

get id(): string;

Defined in: core/src/bucket/bucket.instance.ts:36

The id this bucket was defined with.

string

delete(key): Promise<void>;

Defined in: core/src/bucket/bucket.instance.ts:81

Removes key. Deleting a key that is not there is not an error.

Parameter Type
key string

Promise<void>


exists(key): Promise<boolean>;

Defined in: core/src/bucket/bucket.instance.ts:78

Parameter Type
key string

Promise<boolean>


get(key): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: core/src/bucket/bucket.instance.ts:60

Reads the blob at key; throws BucketObjectNotFoundError if it is missing.

Parameter Type
key string

Promise<Uint8Array<ArrayBufferLike>>


getText(key): Promise<string>;

Defined in: core/src/bucket/bucket.instance.ts:70

Reads the blob at key decoded as UTF-8; throws BucketObjectNotFoundError if it is missing.

Parameter Type
key string

Promise<string>


list(options?): Promise<BucketObject[]>;

Defined in: core/src/bucket/bucket.instance.ts:87

Every object in the bucket, or those under options.prefix, ordered by key.

Parameter Type
options? BucketListOptions

Promise<BucketObject[]>


put(
key,
data,
options?): Promise<BucketObject>;

Defined in: core/src/bucket/bucket.instance.ts:50

Writes data under key, replacing any object already stored there.

Parameter Type
key string
data Uint8Array
options? BucketPutOptions

Promise<BucketObject>


putText(
key,
text,
options?): Promise<BucketObject>;

Defined in: core/src/bucket/bucket.instance.ts:56

Writes text as UTF-8, defaulting the content type to text/plain.

Parameter Type
key string
text string
options? BucketPutOptions

Promise<BucketObject>


stat(key): Promise<
| BucketObject
| undefined>;

Defined in: core/src/bucket/bucket.instance.ts:73

Metadata for key, or undefined when nothing is stored there.

Parameter Type
key string

Promise< | BucketObject | undefined>