Interface Bucket

Bucket is a simple blob store.

Gets are read-after-write consistent for puts of new blobs, and eventually consistent for overwriting puts.

Blobs in a bucket are encrypted at rest by default.

interface Bucket {
    delete(key): Promise<void>;
    get(key): Promise<Buffer>;
    onDelete(name, handler, filter?): void;
    onPut(name, handler, filter?): void;
    put(key, contents): Promise<void>;
}

Methods

  • Delete a blob from the bucket.

    Parameters

    • key: string

      The key of the blob to delete.

    Returns Promise<void>

    A promise for the success or failure of the delete.

  • Get a blob from the bucket.

    Parameters

    • key: string

      The key of the blog to retrieve.

    Returns Promise<Buffer>

    A promise for the success or failure of the get.

  • Registers a handler to be notified when blobs are deleted from the bucket.

    Parameters

    • name: string

      A unique name for the subscription.

    • handler: BucketHandler

      A callback to handle the event.

    • Optional filter: BucketFilter

      A filter to decide which put events should be reported.

    Returns void

  • Registers a handler to be notified when blobs are put into the bucket (created or updated).

    Parameters

    • name: string

      A unique name for the subscription.

    • handler: BucketHandler

      A callback to handle the event.

    • Optional filter: BucketFilter

      A filter to decide which put events should be reported.

    Returns void

  • Insert a blob into the bucket.

    Parameters

    • key: string

      The key to use for retreiving this blob later.

    • contents: Buffer

    Returns Promise<void>

    A promise for the success or failure of the put.

Generated using TypeDoc