Constructs an R2Binding instance.
Optionalsettings: R2Settings
Resolved settings. Defaults to resolve('r2'), so callers
normally construct this with no arguments at all.
The binding name this instance resolves.
The binding name as declared in wrangler.json.
Deletes one or more objects.
Deleting a key that does not exist is not an error.
The Worker environment.
A single object key, or a list of keys.
Reads an object, body included.
The Worker environment.
The object key.
Optionaloptions: R2GetOptions
Get options — range and conditional headers.
The object, or null when it does not exist.
MissingBindingError When the R2 binding is absent.
Reads an object's body as text.
The Worker environment.
The object key.
The body as text, or null when the object does not exist.
Reads an object's metadata without transferring its body.
The Worker environment.
The object key.
The object metadata, or null when it does not exist.
Checks whether the binding is available on the given environment.
Use this to degrade gracefully when a binding is optional.
The Worker environment.
true when the binding is present.
Lists objects in the bucket.
The Worker environment.
Optionaloptions: R2ListOptions
List options — prefix, delimiter, limit, and cursor.
The matched objects and pagination state.
Writes an object.
The Worker environment.
The object key.
The object body.
Optionaloptions: R2PutOptions
Put options — HTTP metadata, custom metadata, and checksums.
The stored object's metadata.
Serialises a value to JSON and writes it as an object.
The Worker environment.
The object key.
The value to serialise and store.
Put options. The JSON content type is applied when unset.
The stored object's metadata.
Resolves the binding, failing fast when it is not configured.
The Worker environment.
The resolved binding.
MissingBindingError When the binding is absent from the environment.
Resolves the binding without throwing.
The Worker environment.
The resolved binding, or null when it is not configured.
Accessor for the R2 bucket binding (
r2_bucketsinwrangler.json).Example
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0