prorm API Reference
    Preparing search index...

    Class R2Store

    Cloudflare R2 store, implementing the minimal NoSqlStore marker interface. Unlike the SQL dialects there is no query(sql) — R2's operations are object-shaped (Put/Get/Delete/List/Head) and that shape is preserved here rather than forced into a SQL string.

    Implements

    Index
    name: "r2" = 'r2'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "@aws-sdk/client-s3" = '@aws-sdk/client-s3'

    The client library being used

    • PutObject — store an object's body (and optional metadata) under bucket/key.

      Parameters

      • bucket: string
      • key: string
      • body: unknown
      • options: PutObjectOptions = {}

      Returns Promise<PutObjectResult>

    • GetObject — fetch an object's body and metadata.

      Parameters

      • bucket: string
      • key: string

      Returns Promise<GetObjectResult>

    • DeleteObject — remove an object. Succeeds even if the key doesn't exist.

      Parameters

      • bucket: string
      • key: string

      Returns Promise<void>

    • ListObjectsV2 — list objects in bucket, optionally restricted to those whose key starts with prefix. A single call returns at most 1000 objects; use result.nextContinuationToken (via the raw client) to page beyond that.

      Parameters

      • bucket: string
      • Optionalprefix: string

      Returns Promise<ListObjectsResult>

    • HeadObject — fetch an object's metadata without its body. Throws (NotFound) if the object doesn't exist.

      Parameters

      • bucket: string
      • key: string

      Returns Promise<HeadObjectResult>

    • Whether an object exists, implemented via HeadObject. Returns false when R2 reports the object is missing (a NotFound / 404 error) rather than throwing; any other error (e.g. access denied) is re-thrown.

      Parameters

      • bucket: string
      • key: string

      Returns Promise<boolean>