@metreeca/core - v0.9.22
    Preparing search index...

    Type Alias Bucket

    Keyed blob store.

    Holds opaque byte values under opaque string keys. Values are written and read as a whole, as key-addressed byte stores provide no in-place update, and are addressed one key at a time, as they provide no enumeration. A stored value is retained until removed, unless the implementation states a retention policy of its own.

    Note

    The contract is deliberately kept close to the cloud object storage APIs, so that an implementation over a service such as Amazon S3, Google Cloud Storage or Cloudflare R2 is a thin adapter over its client.

    type Bucket = {
        get(
            key: string,
        ): Promise<ReadableStream<Uint8Array<ArrayBuffer>> | undefined>;
        put(
            key: string,
            value: ReadableStream<Uint8Array<ArrayBuffer>>,
        ): Promise<void>;
        delete(key: string): Promise<void>;
    }
    Index

    Methods

    Methods

    • Retrieves a value.

      A key is reported as absent whether it was never stored, was removed or was dropped by the bucket under its own retention policy, so a caller must be ready for a stored value to be gone on a later lookup.

      Parameters

      • key: string

        The key of the value to be retrieved

      Returns Promise<ReadableStream<Uint8Array<ArrayBuffer>> | undefined>

      A promise resolving to a stream over the value stored under key, or to undefined if the bucket holds none; a fresh stream is opened on every call, as a stream is consumed once

    • Stores a value.

      Replaces whatever is stored under key, as key-addressed byte stores provide no in-place update, so a caller is free to store a key without first removing it.

      Parameters

      • key: string

        The key the value is to be stored under

      • value: ReadableStream<Uint8Array<ArrayBuffer>>

        A stream over the value to be stored, consumed to completion before the promise settles

      Returns Promise<void>

      A promise resolving when value is stored

    • Removes a value.

      States an outcome rather than a change: removing a key the bucket doesn't hold succeeds without doing anything, so a caller is free to remove a key without first checking for it.

      Parameters

      • key: string

        The key of the value to be removed

      Returns Promise<void>

      A promise resolving when no value is stored under key