Package dev.gmitch215.bytebox.binding
Interface R2Bucket
- All Superinterfaces:
org.teavm.jso.JSObject
public interface R2Bucket
extends org.teavm.jso.JSObject
An R2 bucket. Declared with
r2(), named BLOB by default.
Strongly consistent, unlike KV: a read after a write returns the value that was written.
R2Bucket blob = env.r2();
blob.put("greeting.txt", "hello world!");
String greeting = blob.getText("greeting.txt");
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn object's metadata.static interfaceAn object's metadata together with its body.static interfaceOne page of an object listing. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidRemoves an object.default voidRemoves several objects in one call.org.teavm.jso.core.JSPromise<org.teavm.jso.JSObject> deleteObject(String key) org.teavm.jso.core.JSPromise<org.teavm.jso.JSObject> deleteObjects(org.teavm.jso.core.JSArray<org.teavm.jso.core.JSString> keys) default R2Bucket.R2ObjectBodyReads an object.default org.teavm.jso.typedarrays.ArrayBufferReads an object's body as bytes.org.teavm.jso.core.JSPromise<R2Bucket.R2ObjectBody> org.teavm.jso.core.JSPromise<R2Bucket.R2ObjectBody> default R2Bucket.R2ObjectBodyReads part of an object.default StringReads an object's body as text.default R2Bucket.R2ObjectReads an object's metadata without its body.org.teavm.jso.core.JSPromise<R2Bucket.R2Object> headObject(String key) default R2Bucket.R2Objectslist()Returns the first page of objects.default R2Bucket.R2ObjectsLists objects under a prefix.default R2Bucket.R2ObjectsLists objects from where a previous page left off.Returns every key under a prefix, following the cursor until the listing completes.org.teavm.jso.core.JSPromise<R2Bucket.R2Objects> listObjects(org.teavm.jso.JSObject options) default R2Bucket.R2ObjectWrites text.default R2Bucket.R2ObjectWrites text with a content type.org.teavm.jso.core.JSPromise<R2Bucket.R2Object> org.teavm.jso.core.JSPromise<R2Bucket.R2Object> default R2Bucket.R2ObjectWrites bytes.default R2Bucket.R2ObjectWrites bytes.default R2Bucket.R2ObjectputBytes(String key, org.teavm.jso.typedarrays.ArrayBuffer value, String contentType, TSObject metadata) Writes bytes with a content type and custom metadata.org.teavm.jso.core.JSPromise<R2Bucket.R2Object> org.teavm.jso.core.JSPromise<R2Bucket.R2Object> Methods inherited from interface org.teavm.jso.JSObject
cast
-
Method Details
-
get
Reads an object.- Parameters:
key- the key- Returns:
- the object, or
nullwhen the key is absent
-
getText
Reads an object's body as text.- Parameters:
key- the key- Returns:
- the body, or
nullwhen the key is absent
-
getBytes
Reads an object's body as bytes.- Parameters:
key- the key- Returns:
- the body, or
nullwhen the key is absent
-
getRange
Reads part of an object.- Parameters:
key- the keyoffset- where to startlength- how many bytes to read- Returns:
- the object, or
nullwhen the key is absent
-
head
Reads an object's metadata without its body.- Parameters:
key- the key- Returns:
- the metadata, or
nullwhen the key is absent
-
put
Writes text.- Parameters:
key- the keyvalue- the body- Returns:
- what was written
-
put
Writes text with a content type.- Parameters:
key- the keyvalue- the bodycontentType- the media type to serve it as- Returns:
- what was written
-
putBytes
Writes bytes.- Parameters:
key- the keyvalue- the body- Returns:
- what was written
-
putBytes
Writes bytes.- Parameters:
key- the keyvalue- the body- Returns:
- what was written
-
putBytes
default R2Bucket.R2Object putBytes(String key, org.teavm.jso.typedarrays.ArrayBuffer value, String contentType, TSObject metadata) Writes bytes with a content type and custom metadata.- Parameters:
key- the keyvalue- the bodycontentType- the media type, ornullmetadata- custom metadata, ornull- Returns:
- what was written
-
delete
Removes an object. Succeeds whether or not it was present.- Parameters:
key- the key
-
delete
Removes several objects in one call.- Parameters:
keys- the keys
-
list
Returns the first page of objects.- Returns:
- the first page of objects
-
list
Lists objects under a prefix.- Parameters:
prefix- the prefix- Returns:
- the first page of matching objects
-
list
Lists objects from where a previous page left off.- Parameters:
prefix- the prefix, ornullfor everythingcursor-R2Bucket.R2Objects.getCursor()from the previous pagelimit- how many to return, at most 1000- Returns:
- the next page
-
listAll
Returns every key under a prefix, following the cursor until the listing completes.- Returns:
- every key under a prefix, following the cursor until the listing completes
-
getObject
-
getObject
org.teavm.jso.core.JSPromise<R2Bucket.R2ObjectBody> getObject(String key, org.teavm.jso.JSObject options) -
headObject
-
putText
-
putText
org.teavm.jso.core.JSPromise<R2Bucket.R2Object> putText(String key, String value, org.teavm.jso.JSObject options) -
putBuffer
org.teavm.jso.core.JSPromise<R2Bucket.R2Object> putBuffer(String key, org.teavm.jso.typedarrays.ArrayBuffer value) -
putBuffer
org.teavm.jso.core.JSPromise<R2Bucket.R2Object> putBuffer(String key, org.teavm.jso.typedarrays.ArrayBuffer value, org.teavm.jso.JSObject options) -
deleteObject
-
deleteObjects
org.teavm.jso.core.JSPromise<org.teavm.jso.JSObject> deleteObjects(org.teavm.jso.core.JSArray<org.teavm.jso.core.JSString> keys) -
listObjects
-