method IR2Bucket.put
IR2Bucket.put(
key: string,
value: ArrayBuffer | ArrayBufferView,
options?: R2PutOptions
): Promise<IR2Object | null>

Writes an object.

Parameters

key: string

The object key

value: ArrayBuffer | ArrayBufferView

The object bytes

optional
options: R2PutOptions

R2's own put options. The platform spells the content type httpMetadata.contentType and user metadata customMetadata, which is why R2Storage.put translates rather than forwarding PutObjectOptions unchanged.

Return Type

Promise<IR2Object | null>

The stored object's metadata

Usage

import { type IR2Bucket } from "cloudflare-plugin/src/index.ts";