method R2Storage.prototype.put
R2Storage.prototype.put(
path: string,
data: Uint8Array,
options?: PutObjectOptions
): Promise<void>

Writes an object, translating PutObjectOptions into R2's own spelling: the content type lives under httpMetadata, user metadata under customMetadata. Without this every object was served as application/octet-stream (X8-6).

Parameters

path: string

The object path

The object bytes

optional
options: PutObjectOptions

Object attributes to record with the bytes

Return Type

Promise<void>

Usage

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