pub struct Bucket { /* private fields */ }
Expand description
An instance of the R2 bucket binding.
Implementations§
source§impl Bucket
impl Bucket
sourcepub async fn head(&self, key: impl Into<String>) -> Result<Option<Object>>
pub async fn head(&self, key: impl Into<String>) -> Result<Option<Object>>
Retrieves the Object for the given key containing only object metadata, if the key exists.
sourcepub fn get(&self, key: impl Into<String>) -> GetOptionsBuilder<'_>
pub fn get(&self, key: impl Into<String>) -> GetOptionsBuilder<'_>
sourcepub fn put(
&self,
key: impl Into<String>,
value: impl Into<Data>
) -> PutOptionsBuilder<'_>
pub fn put( &self, key: impl Into<String>, value: impl Into<Data> ) -> PutOptionsBuilder<'_>
Stores the given value
and metadata under the associated key
. Once the write succeeds,
returns an Object containing metadata about the stored Object.
R2 writes are strongly consistent. Once the future resolves, all subsequent read operations will see this key value pair globally.
sourcepub async fn delete(&self, key: impl Into<String>) -> Result<()>
pub async fn delete(&self, key: impl Into<String>) -> Result<()>
Deletes the given value and metadata under the associated key. Once the delete succeeds, returns void.
R2 deletes are strongly consistent. Once the Promise resolves, all subsequent read operations will no longer see this key value pair globally.
sourcepub fn list(&self) -> ListOptionsBuilder<'_>
pub fn list(&self) -> ListOptionsBuilder<'_>
sourcepub fn create_multipart_upload(
&self,
key: impl Into<String>
) -> CreateMultipartUploadOptionsBuilder<'_>
pub fn create_multipart_upload( &self, key: impl Into<String> ) -> CreateMultipartUploadOptionsBuilder<'_>
Creates a multipart upload.
Returns a MultipartUpload value representing the newly created multipart upload. Once the multipart upload has been created, the multipart upload can be immediately interacted with globally, either through the Workers API, or through the S3 API.
sourcepub fn resume_multipart_upload(
&self,
key: impl Into<String>,
upload_id: impl Into<String>
) -> Result<MultipartUpload>
pub fn resume_multipart_upload( &self, key: impl Into<String>, upload_id: impl Into<String> ) -> Result<MultipartUpload>
Returns an object representing a multipart upload with the given key
and uploadId
.
The operation does not perform any checks to ensure the validity of the uploadId
,
nor does it verify the existence of a corresponding active multipart upload.
This is done to minimize latency before being able to call subsequent operations on the returned object.
Trait Implementations§
source§impl EnvBinding for Bucket
impl EnvBinding for Bucket
source§impl JsCast for Bucket
impl JsCast for Bucket
source§fn instanceof(val: &JsValue) -> bool
fn instanceof(val: &JsValue) -> bool
instanceof
check to see whether the JsValue
provided is an instance of this type. Read moresource§fn unchecked_from_js(val: JsValue) -> Self
fn unchecked_from_js(val: JsValue) -> Self
source§fn unchecked_from_js_ref(val: &JsValue) -> &Self
fn unchecked_from_js_ref(val: &JsValue) -> &Self
source§fn has_type<T>(&self) -> boolwhere
T: JsCast,
fn has_type<T>(&self) -> boolwhere T: JsCast,
T
. Read moresource§fn dyn_into<T>(self) -> Result<T, Self>where
T: JsCast,
fn dyn_into<T>(self) -> Result<T, Self>where T: JsCast,
T
. Read moresource§fn dyn_ref<T>(&self) -> Option<&T>where
T: JsCast,
fn dyn_ref<T>(&self) -> Option<&T>where T: JsCast,
T
. Read more